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

Readme, comments #9

Merged
merged 4 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ RadixTarget is:
- Used by:
- [BBOT](https://github.com/blacklanternsecurity/bbot)
- [cloudcheck](https://github.com/blacklanternsecurity/cloudcheck)
Written in pure python and capable of roughly 100,000 lookups per second regardless of database size, it's perfect for production .

### Installation ([PyPi](https://pypi.org/project/radixtarget/))

Expand Down
1 change: 1 addition & 0 deletions radixtarget/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from .radixtarget import RadixTarget
from .helpers import host_size_key # noqa

# alias for convenience
Target = RadixTarget
14 changes: 12 additions & 2 deletions radixtarget/radixtarget.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,22 @@ def get(self, host, raise_error=False):
return self.dns_tree.search(host, raise_error=raise_error)

def search(self, host, raise_error=False):
"""
Alias for get
"""
return self.get(host, raise_error=raise_error)

def insert(self, t, data=None):
self.add(t, data=data)
"""
Alias for add
"""
return self.add(t, data=data)

def put(self, t, data=None):
self.add(t, data=data)
"""
Alias for add
"""
return self.add(t, data=data)

def add(self, t, data=None):
"""
Expand Down Expand Up @@ -114,6 +123,7 @@ def _add(self, host, data=None):
return self._add_host(host, data=data)

def _add_host(self, host, data=None):
host = make_ip(host)
self._hash = None
self._hosts.add(host)
if is_ip(host):
Expand Down
Loading