Documentation
¶
Index ¶
- Constants
- func ConnectToChild(c *net.UnixConn, spec port.Spec, sourceAddr net.Addr) (int, error)
- func ConnectToChildWithRetry(socketPath string, spec port.Spec, retries int, sourceAddr net.Addr) (int, error)
- func ConnectToChildWithSocketPath(socketPath string, spec port.Spec, sourceAddr net.Addr) (int, error)
- type Reply
- type Request
Constants ¶
View Source
const ( RequestTypeInit = "init" RequestTypeConnect = "connect" )
Variables ¶
This section is empty.
Functions ¶
func ConnectToChild ¶
ConnectToChild connects to the child UNIX socket, and obtains TCP or UDP socket FD that corresponds to the port spec. sourceAddr is the real client address (e.g., from net.Conn.RemoteAddr()) for IP_TRANSPARENT support. Pass nil to skip source IP preservation.
Types ¶
type Reply ¶
type Reply struct {
Error string
// SourceIPTransparentBackend is set in the reply to an "init" request:
// the firewall backend ("nft" or "iptables") that was actually set up
// for --source-ip-transparent, resolved eagerly at init time. Empty if
// --source-ip-transparent is disabled, or if no backend could be set up.
SourceIPTransparentBackend string `json:",omitempty"`
}
Reply may contain FD as OOB
type Request ¶
type Request struct {
Type string // "init" or "connect"
Proto string // "tcp", "tcp4", "tcp6", "udp", "udp4", "udp6"
IP string
Port int
ParentIP string
HostGatewayIP string
SourceIP string `json:",omitempty"` // real client IP for IP_TRANSPARENT
SourcePort int `json:",omitempty"` // real client port for IP_TRANSPARENT
}
Request and Response are encoded as JSON with uint32le length header.
Click to show internal directories.
Click to hide internal directories.