Documentation
¶
Overview ¶
Packet proxyProtocol implements Proxy Protocol parser and writer.
Index ¶
Constants ¶
const ( TCP4 = "TCP4" // TCP over IPv4 TCP6 = "TCP6" // TCP over IPv6 UNKNOWN = "UNKNOWN" // Unsupported or unknown protocols )
INET protocol and family
Variables ¶
Functions ¶
This section is empty.
Types ¶
type ProxyLine ¶
type ProxyLine struct { Protocol string SrcAddr *net.IPAddr DstAddr *net.IPAddr SrcPort int DstPort int }
func ConsumeProxyLine ¶
ConsumeProxyLine looks for PROXY line in the reader and try to parse it if found.
If first 5 bytes in reader is "PROXY", the function reads one line (until first '\n') from reader and try to parse it as ProxyLine. A newly allocated ProxyLine is returned if parsing secceeds. If parsing fails, a nil and an error is returned;
If first 5 bytes in reader is not "PROXY", the function simply returns (nil, nil), leaving reader intact (nothing from reader is consumed).
If the being parsed PROXY line is using an unknown protocol, ConsumeProxyLine parses remaining fields as same syntax as a supported protocol assuming IP is used in layer 3, and reports error if failed.