Skip to content

Commit

Permalink
🕊
Browse files Browse the repository at this point in the history
🕊
  • Loading branch information
keyiflerolsun committed Aug 7, 2024
1 parent 6c6093e commit 5d8c8fe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions KeeneticPy/BGPTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ def cidr2mask(cidr:str) -> str:

return f"{(mask >> 24) & 0xFF}.{(mask >> 16) & 0xFF}.{(mask >> 8) & 0xFF}.{mask & 0xFF}"

def asn2cidr(asn:int) -> dict:
if not isinstance(asn, int):
def asn2cidr(asn:str|int) -> dict:
try:
asn = int(asn)
except ValueError:
return {}

oturum = Client()
Expand Down
2 changes: 1 addition & 1 deletion KeeneticPy/Keenetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def add_static_route(self, comment:str, host:str=None, network:str=None, mask:st

return istek.status_code == 200

def add_route_with_asn(self, asn:int, interface:str="Wireguard2"):
def add_route_with_asn(self, asn:str|int, interface:str="Wireguard2"):
asn_data = asn2cidr(asn)
if not asn_data:
assert False, f"ASN {asn} için CIDR bilgisine ulaşılamıyor."
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
setup(
# ? Genel Bilgiler
name = "KeeneticPy",
version = "1.2",
version = "1.3",
url = "https://github.com/keyiflerolsun/KeeneticPy",
description = "Python Lib for Keenetic Routers",
keywords = ["KeeneticPy", "KekikAkademi", "keyiflerolsun"],
Expand Down

0 comments on commit 5d8c8fe

Please sign in to comment.