Documentation
¶
Index ¶
- Constants
- Variables
- type FireInfo
- type Firewall
- func (f *Firewall) EnableForward() error
- func (f *Firewall) ListAddress() ([]FireInfo, error)
- func (f *Firewall) ListForward() ([]FireInfo, error)
- func (f *Firewall) ListPort() ([]FireInfo, error)
- func (f *Firewall) Name() string
- func (f *Firewall) Port(port FireInfo, operation string) error
- func (f *Firewall) PortForward(info Forward, operation string) error
- func (f *Firewall) Reload() error
- func (f *Firewall) Restart() error
- func (f *Firewall) RichRules(rule FireInfo, operation string) error
- func (f *Firewall) Start() error
- func (f *Firewall) Status() (string, error)
- func (f *Firewall) Stop() error
- func (f *Firewall) Version() (string, error)
- type Forward
- type Iptables
- func (iptables *Iptables) Check() error
- func (iptables *Iptables) NatAdd(protocol, src, destIp, destPort string, save bool) error
- func (iptables *Iptables) NatAppendChain() error
- func (iptables *Iptables) NatList(chain ...string) ([]IptablesNatInfo, error)
- func (iptables *Iptables) NatNewChain() error
- func (iptables *Iptables) NatRemove(num string, protocol, src, destIp, destPort string) error
- func (iptables *Iptables) Reload() error
- type IptablesNatInfo
- type Ufw
- func (f *Ufw) EnableForward() error
- func (f *Ufw) ListAddress() ([]FireInfo, error)
- func (f *Ufw) ListForward() ([]FireInfo, error)
- func (f *Ufw) ListPort() ([]FireInfo, error)
- func (f *Ufw) Name() string
- func (f *Ufw) Port(port FireInfo, operation string) error
- func (f *Ufw) PortForward(info Forward, operation string) error
- func (f *Ufw) Reload() error
- func (f *Ufw) Restart() error
- func (f *Ufw) RichRules(rule FireInfo, operation string) error
- func (f *Ufw) Start() error
- func (f *Ufw) Status() (string, error)
- func (f *Ufw) Stop() error
- func (f *Ufw) Version() (string, error)
Constants ¶
View Source
const NatChain = "1PANEL"
Variables ¶
View Source
var ForwardListRegex = regexp.MustCompile(`^port=(\d{1,5}):proto=(.+?):toport=(\d{1,5}):toaddr=(.*)$`)
View Source
var NatListRegex = regexp.MustCompile(`^(\d+)\s+(.+?)\s+(.+?)\s+(.+?)\s+(.+?)\s+(.+?)(?:\s+(.+?) .+?:(\d{1,5}(?::\d+)?).+?[ :](.+-.+|(?:.+:)?\d{1,5}(?:-\d{1,5})?))?$`)
Functions ¶
This section is empty.
Types ¶
type FireInfo ¶
type FireInfo struct { Family string `json:"family"` // ipv4 ipv6 Address string `json:"address"` // Anywhere Port string `json:"port"` Protocol string `json:"protocol"` // tcp udp tcp/udp Strategy string `json:"strategy"` // accept drop Num string `json:"num"` TargetIP string `json:"targetIP"` TargetPort string `json:"targetPort"` UsedStatus string `json:"usedStatus"` Description string `json:"description"` }
type Firewall ¶
type Firewall struct{}
func NewFirewalld ¶
func (*Firewall) EnableForward ¶
func (*Firewall) ListAddress ¶
func (*Firewall) ListForward ¶
type Iptables ¶
type Iptables struct {
CmdStr string
}
func NewIptables ¶
func (*Iptables) NatAppendChain ¶
func (*Iptables) NatList ¶
func (iptables *Iptables) NatList(chain ...string) ([]IptablesNatInfo, error)
func (*Iptables) NatNewChain ¶
type IptablesNatInfo ¶
type Ufw ¶
type Ufw struct {
CmdStr string
}
func (*Ufw) EnableForward ¶
func (*Ufw) ListAddress ¶
func (*Ufw) ListForward ¶
Click to show internal directories.
Click to hide internal directories.