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)
- func Initiate(c *net.UnixConn) 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.
func ConnectToChildWithRetry ¶
func ConnectToChildWithRetry(socketPath string, spec port.Spec, retries int, sourceAddr net.Addr) (int, error)
ConnectToChildWithRetry retries ConnectToChild every (i*5) milliseconds.
Types ¶
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.