Source File
addr_proto.go
Belonging Package
github.com/pires/go-proxyproto
package proxyproto// AddressFamilyAndProtocol represents address family and transport protocol.type AddressFamilyAndProtocol byte// AddressFamilyAndProtocol enum values.const (UNSPEC AddressFamilyAndProtocol = '\x00'TCPv4 AddressFamilyAndProtocol = '\x11'UDPv4 AddressFamilyAndProtocol = '\x12'TCPv6 AddressFamilyAndProtocol = '\x21'UDPv6 AddressFamilyAndProtocol = '\x22'UnixStream AddressFamilyAndProtocol = '\x31'UnixDatagram AddressFamilyAndProtocol = '\x32')// IsIPv4 returns true if the address family is IPv4 (AF_INET4), false otherwise.func ( AddressFamilyAndProtocol) () bool {return &0xF0 == 0x10}// IsIPv6 returns true if the address family is IPv6 (AF_INET6), false otherwise.func ( AddressFamilyAndProtocol) () bool {return &0xF0 == 0x20}// IsUnix returns true if the address family is UNIX (AF_UNIX), false otherwise.func ( AddressFamilyAndProtocol) () bool {return &0xF0 == 0x30}// IsStream returns true if the transport protocol is TCP or STREAM (SOCK_STREAM), false otherwise.func ( AddressFamilyAndProtocol) () bool {return &0x0F == 0x01}// IsDatagram returns true if the transport protocol is UDP or DGRAM (SOCK_DGRAM), false otherwise.func ( AddressFamilyAndProtocol) () bool {return &0x0F == 0x02}// IsUnspec returns true if the transport protocol or address family is unspecified, false otherwise.func ( AddressFamilyAndProtocol) () bool {return (&0xF0 == 0x00) || (&0x0F == 0x00)}func ( AddressFamilyAndProtocol) () byte {if .IsIPv4() && .IsStream() {return byte(TCPv4)} else if .IsIPv4() && .IsDatagram() {return byte(UDPv4)} else if .IsIPv6() && .IsStream() {return byte(TCPv6)} else if .IsIPv6() && .IsDatagram() {return byte(UDPv6)} else if .IsUnix() && .IsStream() {return byte(UnixStream)} else if .IsUnix() && .IsDatagram() {return byte(UnixDatagram)}return byte(UNSPEC)}
![]() |
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. |