Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multi-listen #11644

Merged
merged 14 commits into from
Nov 11, 2018
Merged

Add support for multi-listen #11644

merged 14 commits into from
Nov 11, 2018

Conversation

SeaHOH
Copy link
Contributor

@SeaHOH SeaHOH commented Nov 7, 2018

#11641
添加可监听多个 IP(包括 IPv6),并保持其余行为和旧版一致,需手动编辑配置文件。

定义

IP := "任意有效 IP 或空白字符串"
IP 列表 := [IP, IP, ...]
IP 参数 := IP 或 IP 列表

web control

data/launcher/config.yaml

modules:
  launcher: {control_ip: IP 参数}

gae proxy

data/gae_proxy/config.json

{
  "listen_ip": IP 参数
}

x-tunnel

data/x_tunnel/client.json

{
  "socks_host": IP 参数
}

smart route & dns sever

data/smart_router/config.json

{
  "dns_bind_ip": IP 参数,
  "proxy_bind_ip": IP 参数
}

@njzjz
Copy link

njzjz commented Nov 8, 2018

Exception in thread Thread-3:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/mnt/c/Users/njzjz/Saved Games/XX-Net-3.12.11/code/default/gae_proxy/start.py", line 18, in main
client.main(args)
File "/mnt/c/Users/njzjz/Saved Games/XX-Net-3.12.11/code/default/gae_proxy/local/proxy.py", line 123, in main
if isinstance(listen_ip, str):
UnboundLocalError: local variable 'listen_ip' referenced before assignment

listen_ip = "0.0.0.0"

listen_ips = front.config.listen_ip
if isinstance(listen_ip, str):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

listen_ip应该是listen_ips,另外这个的类型不是str而是unicode……

Suggested change
if isinstance(listen_ip, str):
if not isinstance(listen_ips, list):

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unicode 吗,我再看看。。。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

换成 basestring 了

@njzjz
Copy link

njzjz commented Nov 8, 2018

Exception in thread Thread-50:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/mnt/c/Users/njzjz/Saved Games/XX-Net-3.12.11/code/default/smart_router/start.py", line 19, in main
    client.run(args)
  File "/mnt/c/Users/njzjz/Saved Games/XX-Net-3.12.11/code/default/smart_router/local/__init__.py", line 137, in run
    listen_ips = front.config.dns_bind_ip
NameError: global name 'front' is not defined

self.bing_linsten(ip)

def bing_linsten(self, bind_ip):
if ":" in addr[0]:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exception in thread Thread-50:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/mnt/c/Users/njzjz/Saved Games/XX-Net-3.12.11/code/default/smart_router/start.py", line 19, in main
    client.run(args)
  File "/mnt/c/Users/njzjz/Saved Games/XX-Net-3.12.11/code/default/smart_router/local/__init__.py", line 148, in run
    ttl=g.config.dns_ttl)
  File "/mnt/c/Users/njzjz/Saved Games/XX-Net-3.12.11/code/default/smart_router/local/dns_server.py", line 327, in __init__
    self.init_socket()
  File "/mnt/c/Users/njzjz/Saved Games/XX-Net-3.12.11/code/default/smart_router/local/dns_server.py", line 331, in init_socket
    self.bing_linsten(ip)
  File "/mnt/c/Users/njzjz/Saved Games/XX-Net-3.12.11/code/default/smart_router/local/dns_server.py", line 334, in bing_linsten
    if ":" in addr[0]:
NameError: global name 'addr' is not defined

njzjz and others added 2 commits November 8, 2018 17:15
Co-Authored-By: SeaHOH <Seahoh@Gmail.com>
@njzjz
Copy link

njzjz commented Nov 8, 2018

IP为列表(list)时,访问管理页面报错,

2018-11-08 09:34:26.386 [simple_http_server][ERROR] handler:TypeError('can only concatenate list (not "str") to list',) cmd:GET path:/module/gae_proxy/control/status from:240e:ec:449:3700:d991:5c04:f554:5ee2:34120
2018-11-08 09:34:26.408 [simple_http_server][ERROR] Except stack:Traceback (most recent call last):
  File "/mnt/c/Users/njzjz/Saved Games/XX-Net-3.12.11/code/default/python27/1.0/lib/noarch/simple_http_server.py", line 166, in handle_one_request
    self.do_GET()
  File "/mnt/c/Users/njzjz/Saved Games/XX-Net-3.12.11/code/default/launcher/web_control.py", line 128, in do_GET
    controler.do_GET()
  File "/mnt/c/Users/njzjz/Saved Games/XX-Net-3.12.11/code/default/gae_proxy/local/web_control.py", line 127, in do_GET
    return self.req_status_handler()
  File "/mnt/c/Users/njzjz/Saved Games/XX-Net-3.12.11/code/default/gae_proxy/local/web_control.py", line 340, in req_status_handler
    "proxy_listen": config.listen_ip + ":" + str(config.listen_port),
TypeError: can only concatenate list (not "str") to list

很明显是gae_proxy/local/web_control.py#L340的问题。

其余一切正常。

@SeaHOH
Copy link
Contributor Author

SeaHOH commented Nov 8, 2018

Ok,希望这是最后一处。见笑了。

@njzjz
Copy link

njzjz commented Nov 8, 2018

👌,没问题了

@SeaHOH
Copy link
Contributor Author

SeaHOH commented Nov 8, 2018

好,等你用几天就 merge。

@SeaHOH SeaHOH merged commit 0867292 into master Nov 11, 2018
@SeaHOH SeaHOH changed the title Add support for listen v6 Add support for multi-listen Nov 11, 2018
@SeaHOH SeaHOH deleted the listen-v6 branch November 19, 2018 09:53
@SeaHOH SeaHOH restored the listen-v6 branch November 23, 2018 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants