Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Logger = log.Default()
Functions ¶
func ListenAndServe ¶
ListenAndServe listens on the TCP network address srv.Addr and then calls Serve to handle requests on incoming connections.
func ListenAndServeTLS ¶
ListenAndServeTLS listens on the TCP network address srv.Addr and then calls ServeTLS to handle requests on incoming TLS connections.
Types ¶
type Command ¶
type Command byte
Command represents the command in proxy protocol v2. Command doesn't exist in v1 but it should be set since other parts of this library may rely on it for determining connection details.
type Header ¶
type Header struct {
// LocalAddr is the ip address of the party that initiated the connection
LocalAddr net.Addr
// RemoteAddr is the ip address the remote party connected to; aka the address
// the proxy was listening for connections on.
RemoteAddr net.Addr
// The version of the proxy protocol parsed
Version int
// V2
Command Command
Protocol Protocol
// The unparsed TLVs (Type-Length-Value) that were appended to the end of
// the v2 proto proxy header.
RawTLVs []byte
}
Header represents the structure of the proxy protocol header. It holds information about the connection, such as local and remote addresses, the protocol version, and any additional TLVs (Type-Length-Value) in the v2 protocol.
type Protocol ¶
type Protocol byte
Protocol represents address family and transport protocol.
func (Protocol) IsDatagram ¶
IsDatagram returns true if the transport protocol is UDP or DGRAM (SOCK_DGRAM), false otherwise.
func (Protocol) IsIPv4 ¶
IsIPv4 returns true if the address family is IPv4 (AF_INET4), false otherwise.
func (Protocol) IsIPv6 ¶
IsIPv6 returns true if the address family is IPv6 (AF_INET6), false otherwise.
func (Protocol) IsStream ¶
IsStream returns true if the transport protocol is TCP or STREAM (SOCK_STREAM), false otherwise.