def __init__(self, server=DEFAULT_SERVER, port=DEFAULT_PORT, local_ip=None, debug=False, ip_forward=False):
self.server = server
self.port = port
self.uid = b'test'
self.ip = None
self.debug = debug
if ip_forward:
self.ip = self.server
else:
if local_ip is not None:
self.ip = local_ip
else:
# only available for dormitory subnet
import IpFinder
self.ip = IpFinder.get_ip_startswith('10.21.') or IpFinder.get_ip_startswith('10.20.')
assert ip_forward or self.ip is not None, 'Can not find a correct local ip address. \
Please specify the IP address thought command-line argument using --ip'
self.ip = socket.inet_aton(self.ip)
评论列表
文章目录