MCPcopy Create free account
hub / github.com/apenwarr/sshuttle / islocal

Function islocal

helpers.py:66–78  ·  view source on GitHub ↗
(ip)

Source from the content-addressed store, hash-verified

64
65
66def islocal(ip):
67 sock = socket.socket()
68 try:
69 try:
70 sock.bind((ip, 0))
71 except socket.error, e:
72 if e.args[0] == errno.EADDRNOTAVAIL:
73 return False # not a local IP
74 else:
75 raise
76 finally:
77 sock.close()
78 return True # it's a local IP, or there would have been an error
79
80

Callers 2

onacceptFunction · 0.85
_handle_diversionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected