Documentation ¶
Index ¶
- Variables
- type CmdRunner
- type Config
- func (c *Config) RedirectPort(ctx context.Context, intf string, sourcePort, destinationPort uint16) (err error)
- func (c *Config) RemoveAllowedPort(ctx context.Context, port uint16) (err error)
- func (c *Config) SetAllowedPort(ctx context.Context, port uint16, intf string) (err error)
- func (c *Config) SetEnabled(ctx context.Context, enabled bool) (err error)
- func (c *Config) SetOutboundSubnets(ctx context.Context, subnets []netip.Prefix) (err error)
- func (c *Config) SetVPNConnection(ctx context.Context, connection models.Connection, vpnIntf string) (err error)
- func (c *Config) Version(ctx context.Context) (string, error)
- type Logger
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrIPTablesVersionTooShort = errors.New("iptables version string is too short") ErrPolicyUnknown = errors.New("unknown policy") ErrNeedIP6Tables = errors.New("ip6tables is required, please upgrade your kernel to support it") )
View Source
var ( ErrNetAdminMissing = errors.New("NET_ADMIN capability is missing") ErrTestRuleCleanup = errors.New("failed cleaning up test rule") ErrInputPolicyNotFound = errors.New("input policy not found") ErrIPTablesNotSupported = errors.New("no iptables supported found") )
View Source
var ErrChainListMalformed = errors.New("iptables chain list output is malformed")
View Source
var ErrChainRuleMalformed = errors.New("chain rule is malformed")
View Source
var ErrIptablesCommandMalformed = errors.New("iptables command is malformed")
View Source
var ErrLineNumberIsZero = errors.New("line number is zero")
View Source
var ErrMetricSizeMalformed = errors.New("metric size is malformed")
View Source
var ErrPolicyNotValid = errors.New("policy is not valid")
View Source
var ErrProtocolUnknown = errors.New("unknown protocol")
View Source
var ErrTargetUnknown = errors.New("unknown target")
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func NewConfig ¶
func NewConfig(ctx context.Context, logger Logger, runner CmdRunner, defaultRoutes []routing.DefaultRoute, localNetworks []routing.LocalNetwork, ) (config *Config, err error)
NewConfig creates a new Config instance and returns an error if no iptables implementation is available.
func (*Config) RedirectPort ¶
func (c *Config) RedirectPort(ctx context.Context, intf string, sourcePort, destinationPort uint16, ) (err error)
RedirectPort redirects a source port to a destination port on the interface intf. If intf is empty, it is set to "*" which means all interfaces. If a redirection for the source port given already exists, it is removed first. If the destination port is zero, the redirection for the source port is removed and no new redirection is added.
func (*Config) RemoveAllowedPort ¶
func (*Config) SetAllowedPort ¶
func (*Config) SetEnabled ¶
func (*Config) SetOutboundSubnets ¶
func (*Config) SetVPNConnection ¶
Click to show internal directories.
Click to hide internal directories.