firewall

package
v0.0.0-...-d3309c3 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Direction

type Direction string
var (
	DirectionIn  Direction = "in"  // 传入
	DirectionOut Direction = "out" // 传出
)

type FireForwardInfo

type FireForwardInfo struct {
	Port       uint     `json:"port"`        // 1-65535
	Protocol   Protocol `json:"protocol"`    // tcp udp tcp/udp
	TargetIP   string   `json:"target_ip"`   // 目标地址
	TargetPort uint     `json:"target_port"` // 1-65535
}

type FireInfo

type FireInfo struct {
	Type      Type      `json:"type"`       // rich or normal
	Family    string    `json:"family"`     // ipv4 ipv6
	Address   string    `json:"address"`    // 源地址或目标地址
	PortStart uint      `json:"port_start"` // 1-65535
	PortEnd   uint      `json:"port_end"`   // 1-65535
	Protocol  Protocol  `json:"protocol"`   // tcp udp tcp/udp
	Strategy  Strategy  `json:"strategy"`   // accept drop reject mark
	Direction Direction `json:"direction"`  // in out 入站或出站
}

type Firewall

type Firewall struct {
	// contains filtered or unexported fields
}

func NewFirewall

func NewFirewall() *Firewall

func (*Firewall) Forward

func (r *Firewall) Forward(rule Forward, operation Operation) error

func (*Firewall) ListForward

func (r *Firewall) ListForward() ([]FireForwardInfo, error)

func (*Firewall) ListRichRule

func (r *Firewall) ListRichRule() ([]FireInfo, error)

func (*Firewall) ListRule

func (r *Firewall) ListRule() ([]FireInfo, error)

func (*Firewall) Port

func (r *Firewall) Port(rule FireInfo, operation Operation) error

func (*Firewall) RichRules

func (r *Firewall) RichRules(rule FireInfo, operation Operation) error

func (*Firewall) Status

func (r *Firewall) Status() (bool, error)

func (*Firewall) Version

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

type Forward

type Forward struct {
	Protocol   Protocol `json:"protocol"`    // tcp udp tcp/udp
	Port       uint     `json:"port"`        // 1-65535
	TargetIP   string   `json:"target_ip"`   // 目标地址
	TargetPort uint     `json:"target_port"` // 1-65535
}

type Operation

type Operation string
var (
	OperationAdd    Operation = "add"    // 添加
	OperationRemove Operation = "remove" // 移除
)

type Protocol

type Protocol string
var (
	ProtocolTCP    Protocol = "tcp"     // tcp
	ProtocolUDP    Protocol = "udp"     // udp
	ProtocolTCPUDP Protocol = "tcp/udp" // tcp/udp
)

type Strategy

type Strategy string
var (
	StrategyAccept Strategy = "accept" // 接受
	StrategyDrop   Strategy = "drop"   // 丢弃
	StrategyReject Strategy = "reject" // 拒绝
	StrategyMark   Strategy = "mark"   // 标记
)

type Type

type Type string
var (
	TypeRich   Type = "rich"   // rich
	TypeNormal Type = "normal" // normal
)

Jump to

Keyboard shortcuts

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