[go-nuts] Re: Checking IP against CIDR ranges

2018-05-16 Thread XXX ZZZ
Thanks guys, Patricia Tree did the trick

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Checking IP against CIDR ranges

2018-05-16 Thread Egon
See https://github.com/Kentik/patricia/

On Wednesday, 16 May 2018 03:38:26 UTC+3, XXX ZZZ wrote:
>
> Hello,
>
> I'm trying to check an IP against a list of several CIDR ranges, so far 
> the most obvious way to do it seems to parse both the IP and the cidr 
> ranges (ParseCIDR) and then do a net.contain() however, if we have more 
> than 1 CIDR we have to loop checking one by one which imho is incredible 
> unefficient + slow if the cidr range is big.
>
> Is there any more efficient way of achieving this? I have thought on 
> making a map[string]string with all the IPs (within the CIDR) but the 
> amount of required memory for big lists goes up to a few GB.
>
> Thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.