freebsd network support
This commit is contained in:
parent
5ede07edca
commit
4dece6bc10
1 changed files with 2 additions and 2 deletions
|
@ -132,7 +132,7 @@ def get_public_ipv6():
|
|||
|
||||
def get_interface():
|
||||
interface = ''
|
||||
if sys.platform == 'darwin':
|
||||
if sys.platform == 'darwin' or sys.platform.startswith('freebsd'):
|
||||
#cmd = ['/usr/sbin/netstat', '-rn']
|
||||
cmd = ['/sbin/route', '-n', 'get', 'default']
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, close_fds=True)
|
||||
|
@ -146,7 +146,7 @@ def get_interface():
|
|||
|
||||
def get_local_ipv4():
|
||||
ip = None
|
||||
if sys.platform == 'darwin':
|
||||
if sys.platform == 'darwin' or sys.platform.startswith('freebsd'):
|
||||
cmd = ['/sbin/route', '-n', 'get', 'default']
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, close_fds=True)
|
||||
stdout, stderr = p.communicate()
|
||||
|
|
Loading…
Reference in a new issue