print(_helpText) sys.exit(0) Tunnel.set_tcp_fin_received_handler(tcptun.on_stream_fin_received) Tunnel.set_tcp_closed_handler(tcptun.on_stream_closed) Tunnel.set_udp_closed_handler(udptun.on_dgram_closed) if accept_mode: Tunnel.set_tcp_initial_handler(tcptun.on_server_side_initialized) Tunnel.set_udp_initial_handler(udptun.on_server_side_initialized) for addr, port, type_, arg in server_list: if accept_mode: acceptor = Acceptor('TUNNEL') acceptor.bind(addr, port) acceptor.listen() acceptor.set_on_accepted(server_side_on_accepted) acceptor.set_on_closed(acceptor_on_closed) else: via, to = arg if type_ == 'tcp': acceptor = Acceptor('TCP') acceptor.bind(addr, port) acceptor.listen() acceptor.set_on_accepted(tcptun.gen_on_client_side_accepted(via, to)) acceptor.set_on_closed(acceptor_on_closed) elif type_ == 'udp': receiver = Dgram() receiver.bind(addr, port) receiver.set_on_received(udptun.gen_on_client_side_received(via, to)) receiver.set_on_closed(acceptor_on_closed) receiver.on_tunnel_received = udptun.on_tunnel_received