fix: rootless network

This commit is contained in:
Kirigaya Kazuto 2022-02-06 02:04:45 +00:00
parent e300730f12
commit 045fc93c01

View File

@ -279,6 +279,10 @@ class Parser:
self.idx_tunnels[tunnel_name] = "gateway:{}".format(tunnel_port) self.idx_tunnels[tunnel_name] = "gateway:{}".format(tunnel_port)
self.add_gost_client(tunnel_port, tunnel_remote) self.add_gost_client(tunnel_port, tunnel_remote)
if self.podman_user:
self.add_expose(tunnel_port)
self.idx_tunnels[tunnel_name] = "127.0.0.1:{}".format(tunnel_port)
elif line.startswith('#gost-client-mux '): elif line.startswith('#gost-client-mux '):
parts = line.split(' ')[1:] parts = line.split(' ')[1:]
tunnel_name = parts[0] tunnel_name = parts[0]
@ -290,6 +294,10 @@ class Parser:
self.add_muxer(tunnel_port, tunnel_port+1, tunnel_mux) self.add_muxer(tunnel_port, tunnel_port+1, tunnel_mux)
for mux_idx in range(tunnel_mux): for mux_idx in range(tunnel_mux):
self.add_gost_client(tunnel_port + 1 + mux_idx, tunnel_remote) self.add_gost_client(tunnel_port + 1 + mux_idx, tunnel_remote)
if self.podman_user:
self.add_expose(tunnel_port)
self.idx_tunnels[tunnel_name] = "127.0.0.1:{}".format(tunnel_port)
elif line.startswith('#trojan-server'): elif line.startswith('#trojan-server'):
parts = line.split(' ')[1:] parts = line.split(' ')[1:]
tunnel_name = parts[0] tunnel_name = parts[0]
@ -310,6 +318,10 @@ class Parser:
self.idx_tunnels[tunnel_name] = "gateway:{}".format(tunnel_port) self.idx_tunnels[tunnel_name] = "gateway:{}".format(tunnel_port)
self.add_trojan_client(tunnel_port, tunnel_passwd, tunnel_remote, tunnel_target) self.add_trojan_client(tunnel_port, tunnel_passwd, tunnel_remote, tunnel_target)
if self.podman_user:
self.add_expose(tunnel_port)
self.idx_tunnels[tunnel_name] = "127.0.0.1:{}".format(tunnel_port)
elif line.startswith('#trojan-client-mux '): elif line.startswith('#trojan-client-mux '):
parts = line.split(' ')[1:] parts = line.split(' ')[1:]
tunnel_name = parts[0] tunnel_name = parts[0]
@ -323,6 +335,10 @@ class Parser:
self.add_muxer(tunnel_port, tunnel_port+1, tunnel_mux) self.add_muxer(tunnel_port, tunnel_port+1, tunnel_mux)
for mux_idx in range(tunnel_mux): for mux_idx in range(tunnel_mux):
self.add_trojan_client(tunnel_port + 1 + mux_idx, tunnel_passwd, tunnel_remote, tunnel_target) self.add_trojan_client(tunnel_port + 1 + mux_idx, tunnel_passwd, tunnel_remote, tunnel_target)
if self.podman_user:
self.add_expose(tunnel_port)
self.idx_tunnels[tunnel_name] = "127.0.0.1:{}".format(tunnel_port)
else: else:
sys.stderr.write('[WARN] comment or unknown hint: {}\n'.format(line)) sys.stderr.write('[WARN] comment or unknown hint: {}\n'.format(line))