feat: add functionality to retrieve and bind IP address of network interfaces

This commit is contained in:
Vxrtrauter
2026-02-06 17:50:42 +01:00
parent 4589322f0a
commit 6be1784903
4 changed files with 42 additions and 8 deletions
+9 -1
View File
@@ -41,4 +41,12 @@ def list_interfaces() -> None:
def init_interfaces():
state.interfaces = list(addrs.keys())
state.active_interfaces = get_active_interfaces()
state.active_interfaces = get_active_interfaces()
def get_interface_ip(interface_name):
if interface_name in addrs:
for addr in addrs[interface_name]:
if addr.family == 2: # ipv4
if not addr.address.startswith("127.") and not addr.address.startswith("169.254"):
return addr.address
return None