-
Notifications
You must be signed in to change notification settings - Fork 70
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
Why do you use a sstree instead of a key/value pair? #50
Comments
IPv4 address range is 32 bits and the memory cost of storing each address separately in a map would be too high. Segment tree: https://en.wikipedia.org/wiki/Segment_tree Original implementation: https://github.com/toberndo/go-stree Example list source: https://www.iblocklist.com/lists?fileformat=cidr&archiveformat=gz Doc: Line 42 in 2ae49b7
I don't use Discord but you can email me for other questions. |
Cool, thanks. I will email you. One cool thing about golang is that keys don't need to be strings. So your key could easily be a 32bit int, though you lose 1 byte in the bool. But then each of your tree nodes use 2x 8byte for the left, right pointers.
Now perhaps your blocklist is not used much hence not an issue. Was playing with rain on the command like to see how it works....really cool. Works like a charm. |
The memory space is one part of the problem. The other one is searching. How do you check if an address is blocked by one of the ranges in the blocklist with a map type? |
Hi Cenkati,
Been thinking of a project around torrent and since I love golang, i came across your project. Thank you!
I only had a small question on the use of trees. Why not use a key/value pair with O(1) access and free dedup. Just curious (not a bug)
rain/internal/blocklist/blocklist.go
Line 21 in 2ae49b7
I would love to talk to you about torrent. I have tons of questions. Do you use discord or any other platform??
The text was updated successfully, but these errors were encountered: