Skip to content

Instantly share code, notes, and snippets.

@fbettag
Created December 14, 2012 20:09
Show Gist options
  • Save fbettag/4288254 to your computer and use it in GitHub Desktop.
Save fbettag/4288254 to your computer and use it in GitHub Desktop.
scala> val ip = java.net.InetAddress.getByName("::ffff:1.2.176.0")
ip: java.net.InetAddress = /1.2.176.0
scala> val prefix = new InetPrefix(ip, 20)
prefix: InetPrefix = InetPrefix@6febf6f9
scala> prefix.contains(java.net.InetAddress.getByName("::ffff:1.2.176.20"))
res11: Boolean = true
scala> prefix.contains(java.net.InetAddress.getByName("::ffff:1.2.191.20"))
res12: Boolean = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment