Documentation ¶
Overview ¶
package sockaddrnet provides conversions between net.Addr and syscall.Sockaddr
Index ¶
- Constants
- func IP6ZoneToInt(zone string) int
- func IP6ZoneToString(zone int) string
- func IPAF(ip net.IP) int
- func IPAddrToSockaddr(addr *net.IPAddr) syscall.Sockaddr
- func IPAndZoneToSockaddr(ip net.IP, zone string) syscall.Sockaddr
- func NetAddrAF(addr net.Addr) int
- func NetAddrIPPROTO(addr net.Addr) int
- func NetAddrSOCK(addr net.Addr) int
- func NetAddrToSockaddr(addr net.Addr) syscall.Sockaddr
- func SockaddrToIPAddr(sa syscall.Sockaddr) *net.IPAddr
- func SockaddrToIPAndZone(sa syscall.Sockaddr) (net.IP, string)
- func SockaddrToTCPAddr(sa syscall.Sockaddr) *net.TCPAddr
- func SockaddrToUDPAddr(sa syscall.Sockaddr) *net.UDPAddr
- func SockaddrToUnixAddr(sa syscall.Sockaddr) *net.UnixAddr
- func SockaddrToUnixgramAddr(sa syscall.Sockaddr) *net.UnixAddr
- func SockaddrToUnixpacketAddr(sa syscall.Sockaddr) *net.UnixAddr
- func TCPAddrToSockaddr(addr *net.TCPAddr) syscall.Sockaddr
- func UDPAddrToSockaddr(addr *net.UDPAddr) syscall.Sockaddr
- func UnixAddrToSockaddr(addr *net.UnixAddr) (syscall.Sockaddr, int)
Constants ¶
const ( AF_INET = syscall.AF_INET AF_INET6 = syscall.AF_INET6 AF_UNIX = syscall.AF_UNIX AF_UNSPEC = syscall.AF_UNSPEC IPPROTO_IP = syscall.IPPROTO_IP IPPROTO_IPV4 = syscall.IPPROTO_IPIP IPPROTO_IPV6 = syscall.IPPROTO_IPV6 IPPROTO_TCP = syscall.IPPROTO_TCP IPPROTO_UDP = syscall.IPPROTO_UDP SOCK_DGRAM = syscall.SOCK_DGRAM SOCK_STREAM = syscall.SOCK_STREAM SOCK_SEQPACKET = syscall.SOCK_SEQPACKET )
Variables ¶
This section is empty.
Functions ¶
func IP6ZoneToInt ¶
IP6ZoneToInt converts an IP6 Zone net string to a syscall int returns 0 if zone is ""
func IP6ZoneToString ¶
IP6ZoneToString converts an IP6 Zone syscall int to a net string returns "" if zone is 0
func IPAddrToSockaddr ¶
IPAddrToSockaddr converts a net.IPAddr to a syscall.Sockaddr. Returns nil if conversion fails.
func IPAndZoneToSockaddr ¶
IPAndZoneToSockaddr converts a net.IP (with optional IPv6 Zone) to a syscall.Sockaddr Returns nil if conversion fails.
func NetAddrAF ¶
NetAddrAF returns the syscall AF_* type for a given net.Addr returns AF_UNSPEC if unknown
func NetAddrIPPROTO ¶
NetAddrIPPROTO returns the syscall IPPROTO_* type for a given net.Addr returns -1 if protocol unknown
func NetAddrSOCK ¶
NetAddrSOCK returns the syscall SOCK_* type for a given net.Addr returns 0 if type unknown
func NetAddrToSockaddr ¶
NetAddrToSockaddr converts a net.Addr to a syscall.Sockaddr. Returns nil if the input is invalid or conversion is not possible.
func SockaddrToIPAddr ¶
SockaddrToIPAddr converts a syscall.Sockaddr to a net.IPAddr Returns nil if conversion fails.
func SockaddrToIPAndZone ¶
IPAndZoneToSockaddr converts a net.IP (with optional IPv6 Zone) to a syscall.Sockaddr Returns nil if conversion fails.
func SockaddrToTCPAddr ¶
SockaddrToTCPAddr converts a syscall.Sockaddr to a net.TCPAddr Returns nil if conversion fails.
func SockaddrToUDPAddr ¶
SockaddrToUDPAddr converts a syscall.Sockaddr to a net.UDPAddr Returns nil if conversion fails.
func SockaddrToUnixAddr ¶
SockaddrToUnixAddr converts a syscall.Sockaddr to a net.UnixAddr Returns nil if conversion fails.
func SockaddrToUnixgramAddr ¶
SockaddrToUnixgramAddr converts a syscall.Sockaddr to a net.UnixAddr Returns nil if conversion fails.
func SockaddrToUnixpacketAddr ¶
SockaddrToUnixpacketAddr converts a syscall.Sockaddr to a net.UnixAddr Returns nil if conversion fails.
func TCPAddrToSockaddr ¶
TCPAddrToSockaddr converts a net.TCPAddr to a syscall.Sockaddr. Returns nil if conversion fails.
func UDPAddrToSockaddr ¶
UDPAddrToSockaddr converts a net.UDPAddr to a syscall.Sockaddr. Returns nil if conversion fails.
Types ¶
This section is empty.