client

package
v1.10.29-lts Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PreRoutingChain  = "1PANEL_PREROUTING"
	PostRoutingChain = "1PANEL_POSTROUTING"
	ForwardChain     = "1PANEL_FORWARD"
)
View Source
const (
	FilterTab = "filter"
	NatTab    = "nat"
)

Variables

View Source
var ForwardListRegex = regexp.MustCompile(`^port=(\d{1,5}):proto=(.+?):toport=(\d{1,5}):toaddr=(.*)$`)

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 NewFirewalld() (*Firewall, error)

func (*Firewall) EnableForward

func (f *Firewall) EnableForward() error

func (*Firewall) ListAddress

func (f *Firewall) ListAddress() ([]FireInfo, error)

func (*Firewall) ListForward

func (f *Firewall) ListForward() ([]FireInfo, error)

func (*Firewall) ListPort

func (f *Firewall) ListPort() ([]FireInfo, error)

func (*Firewall) Name

func (f *Firewall) Name() string

func (*Firewall) Port

func (f *Firewall) Port(port FireInfo, operation string) error

func (*Firewall) PortForward

func (f *Firewall) PortForward(info Forward, operation string) error

func (*Firewall) Reload

func (f *Firewall) Reload() error

func (*Firewall) Restart added in v1.9.2

func (f *Firewall) Restart() error

func (*Firewall) RichRules

func (f *Firewall) RichRules(rule FireInfo, operation string) error

func (*Firewall) Start

func (f *Firewall) Start() error

func (*Firewall) Status

func (f *Firewall) Status() (string, error)

func (*Firewall) Stop

func (f *Firewall) Stop() error

func (*Firewall) Version

func (f *Firewall) Version() (string, error)

type Forward

type Forward struct {
	Num        string `json:"num"`
	Protocol   string `json:"protocol"`
	Port       string `json:"port"`
	TargetIP   string `json:"targetIP"`
	TargetPort string `json:"targetPort"`
}

type Iptables

type Iptables struct {
	CmdStr string
}

func NewIptables

func NewIptables() (*Iptables, error)

func (*Iptables) AppendChain

func (iptables *Iptables) AppendChain(tab string, chain, chain1 string) error

func (*Iptables) Check

func (iptables *Iptables) Check() error

func (*Iptables) NatAdd

func (iptables *Iptables) NatAdd(protocol, srcPort, dest, destPort string, save bool) error

func (*Iptables) NatList

func (iptables *Iptables) NatList(chain ...string) ([]IptablesNatInfo, error)

func (*Iptables) NatRemove

func (iptables *Iptables) NatRemove(num string, protocol, srcPort, dest, destPort string) error

func (*Iptables) NewChain

func (iptables *Iptables) NewChain(tab, chain string) error

func (*Iptables) Reload

func (iptables *Iptables) Reload() error

type IptablesFilterInfo

type IptablesFilterInfo struct {
	Num         string `json:"num"`
	Target      string `json:"target"`
	Protocol    string `json:"protocol"`
	Opt         string `json:"opt"`
	Source      string `json:"source"`
	Destination string `json:"destination"`
}

type IptablesNatInfo

type IptablesNatInfo struct {
	Num         string `json:"num"`
	Target      string `json:"target"`
	Protocol    string `json:"protocol"`
	Opt         string `json:"opt"`
	Source      string `json:"source"`
	Destination string `json:"destination"`
	SrcPort     string `json:"srcPort"`
	DestPort    string `json:"destPort"`
}

type Ufw

type Ufw struct {
	CmdStr string
}

func NewUfw

func NewUfw() (*Ufw, error)

func (*Ufw) EnableForward

func (f *Ufw) EnableForward() error

func (*Ufw) ListAddress

func (f *Ufw) ListAddress() ([]FireInfo, error)

func (*Ufw) ListForward

func (f *Ufw) ListForward() ([]FireInfo, error)

func (*Ufw) ListPort

func (f *Ufw) ListPort() ([]FireInfo, error)

func (*Ufw) Name

func (f *Ufw) Name() string

func (*Ufw) Port

func (f *Ufw) Port(port FireInfo, operation string) error

func (*Ufw) PortForward

func (f *Ufw) PortForward(info Forward, operation string) error

func (*Ufw) Reload

func (f *Ufw) Reload() error

func (*Ufw) Restart added in v1.9.2

func (f *Ufw) Restart() error

func (*Ufw) RichRules

func (f *Ufw) RichRules(rule FireInfo, operation string) error

func (*Ufw) Start

func (f *Ufw) Start() error

func (*Ufw) Status

func (f *Ufw) Status() (string, error)

func (*Ufw) Stop

func (f *Ufw) Stop() error

func (*Ufw) Version

func (f *Ufw) Version() (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL