Documentation ¶
Overview ¶
Package proxy provides a network Proxy interface and implementations for TCP and UDP.
Index ¶
Constants ¶
const ( // UDPConnTrackTimeout is the timeout used for UDP connection tracking UDPConnTrackTimeout = 90 * time.Second // UDPBufSize is the buffer size for the UDP proxy UDPBufSize = 65507 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Proxy ¶
type Proxy interface { // Run starts forwarding traffic back and forth between the front // and back-end addresses. Run() // Close stops forwarding traffic and close both ends of the Proxy. Close() // FrontendAddr returns the address on which the proxy is listening. FrontendAddr() net.Addr // BackendAddr returns the proxied address. BackendAddr() net.Addr }
Proxy defines the behavior of a proxy. It forwards traffic back and forth between two endpoints : the frontend and the backend. It can be used to do software port-mapping between two addresses. e.g. forward all traffic between the frontend (host) 127.0.0.1:3000 to the backend (container) at 172.17.42.108:4000.
type StubProxy ¶
type StubProxy struct {
// contains filtered or unexported fields
}
StubProxy is a proxy that is a stub (does nothing).
func (*StubProxy) BackendAddr ¶
BackendAddr returns the backend address.
func (*StubProxy) FrontendAddr ¶
FrontendAddr returns the frontend address.
type TCPProxy ¶
type TCPProxy struct {
// contains filtered or unexported fields
}
TCPProxy is a proxy for TCP connections. It implements the Proxy interface to handle TCP traffic forwarding between the frontend and backend addresses.
func NewTCPProxy ¶
NewTCPProxy creates a new TCPProxy.
func (*TCPProxy) BackendAddr ¶
BackendAddr returns the TCP proxied address.
func (*TCPProxy) FrontendAddr ¶
FrontendAddr returns the TCP address on which the proxy is listening.
type UDPProxy ¶
type UDPProxy struct {
// contains filtered or unexported fields
}
UDPProxy is proxy for which handles UDP datagrams. It implements the Proxy interface to handle UDP traffic forwarding between the frontend and backend addresses.
func NewUDPProxy ¶
NewUDPProxy creates a new UDPProxy.
func (*UDPProxy) BackendAddr ¶
BackendAddr returns the proxied UDP address.
func (*UDPProxy) FrontendAddr ¶
FrontendAddr returns the UDP address on which the proxy is listening.