Good evening everyone, so you thought i stopped blogging, but i didn't. What i did do? Well, i wrote some amazing Scala stuff.
Apart from my Liftweb, Netty and Akka Talk at SkillsMatter, London, i was busy coding some awesome stuff for one of the new projects i am involved in. Maybe you've already seen me tweeting about them, but in case you haven't, you may Follow @wastedio on Twitter.
Why am i blogging? Well you can guess it's awesome, otherwise i wouldn't write about it ;)
Since Twitter and everyone has their own "utils" Library, we also had to have our own. But since we don't simply clone other people's work, we did some nice IP Subnet Matching for my high performance audience.
It all started when i repeatedly googled for a Scala IPv4 and IPv6 Subnet Matching Library. Since i write a lot of Liftweb Code, i sometimes need to match for a certain IP-Range, which is not easy when you have to use different libraries (v6 Java, v4 Scala) in order to find out if the given client comes from Range $x.
I found a 1-year old question on StackOverflow and tried out the code, to my dismay this happened:
But if you calculate the network 126.96.36.199/20 then you get a Range up to 188.8.131.52 (which should return true on res2):
So i felt obligated to contribute my own code to the Scala Community which can be found on the wasted.io Github Repository for their Scala-Utils. It is licensed under Apache-License so feel free to use it however you feel like!
Now we are able to do real Subnet matching:
To use it, you currently have to assemble and publish it local, we're working on getting it on a publicly known Ivy/Maven-Repository. Also check the README.md if you're having troubles.
I can only encourage everyone to follow the stuff wasted.io (@wastedio on Twitter) has coming out in the future. We are preparing the release of our Open Source Netflow Collector called netflow.io which is based on netty and akka which is compatible with RFC3954, RFC5101, RFC5102, so make sure you stay tuned!