forked from p15670423/monkey
Common: Add get_my_ip_addresses() -> Sequence[IPv4Address]
This commit is contained in:
parent
a89d76a4c5
commit
fc4c05405b
|
@ -1,12 +1,16 @@
|
|||
import ipaddress
|
||||
from ipaddress import IPv4Interface
|
||||
from ipaddress import IPv4Address, IPv4Interface
|
||||
from typing import List, Optional, Sequence, Tuple
|
||||
|
||||
from netifaces import AF_INET, ifaddresses, interfaces
|
||||
|
||||
|
||||
def get_my_ip_addresses_legacy() -> Sequence[str]:
|
||||
return [str(interface.ip) for interface in get_network_interfaces()]
|
||||
return [str(ip) for ip in get_my_ip_addresses()]
|
||||
|
||||
|
||||
def get_my_ip_addresses() -> Sequence[IPv4Address]:
|
||||
return [interface.ip for interface in get_network_interfaces()]
|
||||
|
||||
|
||||
def get_network_interfaces() -> List[IPv4Interface]:
|
||||
|
|
Loading…
Reference in New Issue