// IPAddress creates an Address with given IP.
IPAddress creates an Address with given IP.
// IPAddress creates an Address with given IP .
func IPAddress(ip []byte) Address {
	switch len(ip) {
	case net.IPv4len:
		var addr ipv4Address = [4]byte{ip[0], ip[1], ip[2], ip[3]}
		return addr
	case net.IPv6len:
		if predicate.BytesAll(ip[0:10], 0) && predicate.BytesAll(ip[10:12], 0xff) {
			return IPAddress(ip[12:16])
		}
		var addr ipv6Address = [16]byte{
			ip[0], ip[1], ip[2], ip[3],
			ip[4], ip[5], ip[6], ip[7],
			ip[8], ip[9], ip[10], ip[11],
			ip[12], ip[13], ip[14], ip[15],
		}
		return addr
	default:
		newError("invalid IP format: ", ip).AtError().WriteToLog()
		return nil
	}
}
func IPAddress ( ip [ ] byte ) Address { switch len ( ip ) { case net . IPv4len : var addr ipv4Address = [ 4 ] byte { ip [ 0 ] , ip [ 1 ] , ip [ 2 ] , ip [ 3 ] } return addr case net . IPv6len : if predicate . BytesAll ( ip [ 0 : 10 ] , 0 ) && predicate . BytesAll ( ip [ 10 : 12 ] , 0xff ) { return IPAddress ( ip [ 12 : 16 ] ) } var addr ipv6Address = [ 16 ] byte { ip [ 0 ] , ip [ 1 ] , ip [ 2 ] , ip [ 3 ] , ip [ 4 ] , ip [ 5 ] , ip [ 6 ] , ip [ 7 ] , ip [ 8 ] , ip [ 9 ] , ip [ 10 ] , ip [ 11 ] , ip [ 12 ] , ip [ 13 ] , ip [ 14 ] , ip [ 15 ] , } return addr default : newError ( " " , ip ) . AtError ( ) . WriteToLog ( ) return nil } }
IPAddress creates an Address with given IP.
IPAddress creates an Address with given IP .