SockaddrToIP converts socket address to an IP Somewhat copy from https://github.com/golang/go/blob/658b5e66ecbc41a49e6fb5aa63c5d9c804cf305f/src/net/udpsock_posix.go#L15
(sa unix.Sockaddr)
| 207 | sa := &unix.SockaddrInet6{Port: port} |
| 208 | copy(sa.Addr[:], ip.To16()) |
| 209 | return sa |
| 210 | } |
| 211 | |
| 212 | // AddrToSockaddr converts netip.Addr + port into a socket address |
| 213 | func AddrToSockaddr(ip netip.Addr, port int) unix.Sockaddr { |
| 214 | if ip.Is4() { |
| 215 | return &unix.SockaddrInet4{Port: port, Addr: ip.As4()} |
| 216 | } |
| 217 | return &unix.SockaddrInet6{Port: port, Addr: ip.As16()} |
| 218 | } |
| 219 | |
| 220 | // SockaddrToIP converts socket address to an IP |
no outgoing calls
searching dependent graphs…