net/ip.go
func (n NetworkNumber) ToIP() net.IP {
	ip := make(net.IP, len(n)*BytePerUint32)
	for i := 0; i < len(n); i++ {
		idx := i * net.IPv4len
		binary.BigEndian.PutUint32(ip[idx:idx+net.IPv4len], n[i])
	}
	if len(ip) == net.IPv4len {
		ip = net.IPv4(ip[0], ip[1], ip[2], ip[3])
	}
	return ip
}
func (n NetworkNumber) ToIP() net.IP {
	ip := make(net.IP, len(n)*BytePerUint32)
	for i := 0; i < len(n); i++ {
		idx := i * net.IPv4len
		binary.BigEndian.PutUint32(ip[idx:idx+net.IPv4len], n[i])
	}
	if len(ip) == net.IPv4len {
		ip = net.IPv4(ip[0], ip[1], ip[2], ip[3])
	}
	return ip
}
func ( n NetworkNumber ) ToIP ( ) net . IP { ip := make ( net . IP , len ( n ) * BytePerUint32 ) for i := 0 ; i < len ( n ) ; i ++ { idx := i * net . IPv4len binary . BigEndian . PutUint32 ( ip [ idx : idx + net . IPv4len ] , n [ i ] ) } if len ( ip ) == net . IPv4len { ip = net . IPv4 ( ip [ 0 ] , ip [ 1 ] , ip [ 2 ] , ip [ 3 ] ) } return ip }
// ToIP returns equivalent net.IP.
ToIP returns equivalent net . IP .