mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 09:59:41 +02:00
feat: add functionality to retrieve and bind IP address of network interfaces
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user