MCPcopy Create free account
hub / github.com/facebook/time / SockaddrToAddr

Function SockaddrToAddr

timestamp/timestamp.go:221–229  ·  view source on GitHub ↗

SockaddrToAddr converts socket address to a netip.Addr Somewhat copy from https://github.com/golang/go/blob/658b5e66ecbc41a49e6fb5aa63c5d9c804cf305f/src/net/udpsock_posix.go#L15

(sa unix.Sockaddr)

Source from the content-addressed store, hash-verified

219
220// SockaddrToIP converts socket address to an IP
221// Somewhat copy from https://github.com/golang/go/blob/658b5e66ecbc41a49e6fb5aa63c5d9c804cf305f/src/net/udpsock_posix.go#L15
222func SockaddrToIP(sa unix.Sockaddr) net.IP {
223 switch sa := sa.(type) {
224 case *unix.SockaddrInet4:
225 return sa.Addr[0:]
226 case *unix.SockaddrInet6:
227 return sa.Addr[0:]
228 }
229 return nil
230}
231
232// SockaddrToAddr converts socket address to a netip.Addr

Callers 6

RunListenerMethod · 0.92
ReadPacketBufMethod · 0.92
TestSockaddrToAddrIPv4Function · 0.85
TestSockaddrToAddrIPv6Function · 0.85
TestSockaddrToAddrNilFunction · 0.85

Calls

no outgoing calls

Tested by 3

TestSockaddrToAddrIPv4Function · 0.68
TestSockaddrToAddrIPv6Function · 0.68
TestSockaddrToAddrNilFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…