Source File
version_cmd.go
Belonging Package
github.com/pires/go-proxyproto
package proxyproto// ProtocolVersionAndCommand 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 ProtocolVersionAndCommand byteconst (// LOCAL represents the LOCAL command in v2 or UNKNOWN transport in v1,// in which case no address information is expected.LOCAL ProtocolVersionAndCommand = '\x20'// PROXY represents the PROXY command in v2 or transport is not UNKNOWN in v1,// in which case valid local/remote address and port information is expected.PROXY ProtocolVersionAndCommand = '\x21')var supportedCommand = map[ProtocolVersionAndCommand]bool{LOCAL: true,PROXY: true,}// IsLocal returns true if the command in v2 is LOCAL or the transport in v1 is UNKNOWN,// i.e. when no address information is expected, false otherwise.func ( ProtocolVersionAndCommand) () bool {return LOCAL ==}// IsProxy returns true if the command in v2 is PROXY or the transport in v1 is not UNKNOWN,// i.e. when valid local/remote address and port information is expected, false otherwise.func ( ProtocolVersionAndCommand) () bool {return PROXY ==}// IsUnspec returns true if the command is unspecified, false otherwise.func ( ProtocolVersionAndCommand) () bool {// Must be LOCAL or PROXY.return !.IsLocal() && !.IsProxy()}func ( ProtocolVersionAndCommand) () byte {if .IsLocal() {return byte(LOCAL)} else if .IsProxy() {return byte(PROXY)}return byte(LOCAL)}
![]() |
The pages are generated with Golds v0.8.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |