Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IPv4 and IPv6 collision #2

Open
fishnux opened this issue Mar 22, 2020 · 1 comment
Open

IPv4 and IPv6 collision #2

fishnux opened this issue Mar 22, 2020 · 1 comment

Comments

@fishnux
Copy link

fishnux commented Mar 22, 2020

There seems to be a collision with the following specific CIDRs:

  • 42.0.0.0/22
  • 2a00::/22
package main

import (
	"fmt"
	"github.com/asergeyev/nradix"
)

func main() {
	tr := nradix.NewTree(0)
	
	err := tr.AddCIDR("42.0.0.0/22", "Got 42.0.0.0/22")
	if err != nil {
		fmt.Print(err)
	}

	inf, err := tr.FindCIDR("2a00::/22")
	if err != nil {
		fmt.Print(err)
	}
	
	fmt.Print(inf)
}

https://play.golang.org/p/xQiaBZQZkWi

@lior-k
Copy link

lior-k commented Apr 26, 2020

yes, I'm encountering the same issue.
I'm feeding the tree IPV4 CIDRs only and when I ask on an IPv6 - it finds it in the tree.
Can we please have a fix for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants