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

Blocklist Tree #9

Closed
attilaolah opened this issue Jan 24, 2015 · 0 comments · Fixed by #15
Closed

Blocklist Tree #9

attilaolah opened this issue Jan 24, 2015 · 0 comments · Fixed by #15

Comments

@attilaolah
Copy link
Contributor

Store the blocklist in a tree structure.

This should reduce the big memory overhead since we would not store the duplicate segments in the hostnames any more. Implement something along the lines of this:

type Tree struct {
    Head string
    Tail map[string]Tree
}

Then, compile the hostnames in reverse segments, to end up with something like this:

  • "com"
    • "facebook"
      • "apps"
    • "twitter"
  • "net"
    • "example"
      • ""
      • "www"

This tree should be equivalent to:

apps.facebook.com
twitter.com
example.net
www.example.net

Since there are a ton of subdomains in the hosts file, and many common TLDs, this could potentially reduce the memory footprint, and could also make the lookups faster (or slower due to the overhead, we should check).

@attilaolah attilaolah added this to the Gopher Gala milestone Jan 24, 2015
@attilaolah attilaolah self-assigned this Jan 24, 2015
@attilaolah attilaolah modified the milestone: Gopher Gala Jan 24, 2015
@attilaolah attilaolah mentioned this issue Jan 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant