@@ -196,6 +196,10 @@ sealed abstract class IpAddress extends IpAddressPlatform with Host with Seriali
196196 /** Maps a type-preserving function across this IP address. */
197197 def transform (v4 : Ipv4Address => Ipv4Address , v6 : Ipv6Address => Ipv6Address ): this .type
198198
199+ /** Returns true if this address is either 0.0.0.0 or ::. */
200+ def isWildcard : Boolean =
201+ fold(_ == Ipv4Address .Wildcard , _ == Ipv6Address .Wildcard )
202+
199203 /** Returns true if this address is in the multicast range. */
200204 def isMulticast : Boolean
201205
@@ -425,6 +429,9 @@ final class Ipv4Address private (protected val bytes: Array[Byte]) extends IpAdd
425429
426430object Ipv4Address extends Ipv4AddressCompanionPlatform {
427431
432+ /** Wildcard IPv4 address - 0.0.0.0 */
433+ val Wildcard : Ipv4Address = fromBytes(0 , 0 , 0 , 0 )
434+
428435 /** First IP address in the IPv4 multicast range. */
429436 val MulticastRangeStart : Ipv4Address = fromBytes(224 , 0 , 0 , 0 )
430437
@@ -699,6 +706,10 @@ final class Ipv6Address private (protected val bytes: Array[Byte]) extends IpAdd
699706
700707object Ipv6Address extends Ipv6AddressCompanionPlatform {
701708
709+ /** Wildcard IPv6 address - 0.0.0.0 */
710+ val Wildcard : Ipv6Address =
711+ fromBytes(0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 )
712+
702713 /** First IP address in the IPv6 multicast range. */
703714 val MulticastRangeStart : Ipv6Address =
704715 fromBytes(255 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 )
0 commit comments