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 7959f43 commit 629d6ad
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions KeeneticPy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,15 @@ def get_static_routes(self) -> list[dict[str, str]]:
json = {"show":{"ip":{"route":{}}}}
).json().get("ip", {}).get("route", [])

@staticmethod
def cidr_to_mask(cidr):
""" https://bgp.tools/as/32934#prefixes """
ip, prefix = cidr.split("/")
prefix = int(prefix)
mask = (0xFFFFFFFF >> (32 - prefix)) << (32 - prefix)

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

def add_static_route(self, comment:str, host:str=None, network:str=None, mask:str=None, interface:str="Wireguard2") -> bool:
payload = None

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 = "0.8",
version = "0.9",
url = "https://github.com/keyiflerolsun/KeeneticPy",
description = "Python Lib for Keenetic Routers",
keywords = ["KeeneticPy", "KekikAkademi", "keyiflerolsun"],
Expand Down

0 comments on commit 629d6ad

Please sign in to comment.