Documentation
¶
Index ¶
- Constants
- Variables
- func AddPolicy(policy Policy) error
- func AddPortForward(zone string, portForward *PortForward, permanent bool) error
- func AddTrafficRule(zone string, rule *TrafficRule, permanent bool) error
- func AddZone(zone *Zone) error
- func GetDefaultZone() (string, error)
- func GetICMPTypeNames(permanent bool) ([]string, error)
- func GetServiceNames(permanent bool) ([]string, error)
- func GetZoneNames(permanent bool) ([]string, error)
- func Reload() error
- func RemovePortForward(zone string, portForward *PortForward, permanent bool) error
- func RemoveTrafficRule(zone string, rule *TrafficRule, permanent bool) error
- func RemoveZone(name string) error
- func Reset() error
- func SetDefaultZone(name string) error
- func UpdatePolicy(name string, policy Policy, permanent bool) error
- func UpdateZone(name string, zone *Zone, permanent bool) error
- type ForwardProtocol
- type Policy
- type PolicyStrategy
- type Port
- type PortForward
- type RuleLog
- type RuleStrategy
- type RuleType
- type TrafficRule
- type Zone
- type ZoneStrategy
Constants ¶
View Source
const ( AcceptPolicyStrategy = "ACCEPT" DefaultPolicyStrategy = "default" RejectPolicyStrategy = "REJECT" ContinuePolicyStrategy = "CONTINUE" DropPolicyStrategy = "DROP" )
View Source
const ( AcceptZoneStrategy = "ACCEPT" DefaultZoneStrategy = "default" RejectZoneStrategy = "%%REJECT%%" ContinueZoneStrategy = "CONTINUE" DropZoneStrategy = "DROP" )
Variables ¶
View Source
var NotFoundErr = errors.New("not found")
Functions ¶
func AddPortForward ¶
func AddPortForward(zone string, portForward *PortForward, permanent bool) error
func AddTrafficRule ¶
func AddTrafficRule(zone string, rule *TrafficRule, permanent bool) error
func GetDefaultZone ¶
func GetICMPTypeNames ¶
func GetServiceNames ¶
func GetZoneNames ¶
func RemovePortForward ¶
func RemovePortForward(zone string, portForward *PortForward, permanent bool) error
func RemoveTrafficRule ¶
func RemoveTrafficRule(zone string, rule *TrafficRule, permanent bool) error
func RemoveZone ¶
func SetDefaultZone ¶
func UpdatePolicy ¶
UpdatePolicy update policy setting, name, short, target and description field only change in permanent
Types ¶
type ForwardProtocol ¶
type ForwardProtocol string
const ( TCPForwardProtocol ForwardProtocol = "tcp" UDPForwardProtocol ForwardProtocol = "udp" SCTPForwardProtocol ForwardProtocol = "sctp" DCCPForwardProtocol ForwardProtocol = "dccp" )
type Policy ¶
type Policy struct {
Name string `json:"name"`
Short string `json:"short"`
Description string `json:"description"`
Target string `json:"target"`
IngressZones []string `json:"ingressZones"`
EgressZones []string `json:"egressZones"`
Services []string `json:"services"`
ICMPBlocks []string `json:"icmpBlocks"`
Priority int `json:"priority"`
Masquerade bool `json:"masquerade"`
ForwardPorts []*PortForward `json:"forwardPorts"`
RichRules []string `json:"richRules"`
Protocols []string `json:"protocols"`
Ports []*Port `json:"ports"`
SourcePorts []*Port `json:"sourcePorts"`
}
func GetPolicies ¶
type PolicyStrategy ¶
type PolicyStrategy string
type PortForward ¶
type PortForward struct {
// Port port number or range
Port string `json:"port"`
Protocol ForwardProtocol `json:"protocol"`
// ToPort port number or range
ToPort string `json:"toPort"`
ToAddress string `json:"toAddress"`
}
func GetPortForwards ¶
func GetPortForwards(zone string, permanent bool) ([]*PortForward, error)
type RuleStrategy ¶
type RuleStrategy int
const ( AcceptRuleStrategy RuleStrategy = iota RejectRuleStrategy DropRuleStrategy )
type TrafficRule ¶
type TrafficRule struct {
// Family ipv4 or ipv6, empty means both
Family string `json:"family"`
// SrcAddr source address
SrcAddr string `json:"srcAddr,omitempty"`
SrcAddrInvert bool `json:"srcAddrInvert,omitempty"`
// DestAddr destination address
DestAddr string `json:"destAddr,omitempty"`
DestAddrInvert bool `json:"destAddrInvert,omitempty"`
Strategy RuleStrategy `json:"strategy"`
Type RuleType `json:"type"`
Value json.RawMessage `json:"value"`
Log RuleLog `json:"log"`
Audit bool `json:"audit"`
}
func GetTrafficRules ¶
func GetTrafficRules(zone string, permanent bool) ([]*TrafficRule, error)
type Zone ¶
type Zone struct {
Name string `json:"name"`
Description string `json:"description"`
Target ZoneStrategy `json:"target"`
IngressPriority int `json:"ingressPriority"`
EgressPriority int `json:"egressPriority"`
ICMPBlocks []string `json:"icmpBlocks"`
ICMPBlockInversion bool `json:"icmpBlockInversion"`
Masquerade bool `json:"masquerade"`
Forward bool `json:"forward"`
Interfaces []string `json:"interfaces"`
Protocols []string `json:"protocols"`
}
type ZoneStrategy ¶
type ZoneStrategy string
Click to show internal directories.
Click to hide internal directories.