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

纯IPv6本地监听支持 #2419

Merged
merged 6 commits into from Jul 2, 2019

Conversation

@Yifei0727
Copy link
Contributor

commented Jun 19, 2019

Please follow the guide below

  • You will be asked some questions, please read them carefully and answer honestly

  • Put an x into all the boxes [ ] relevant to your pull request (like that [x])

  • Use Preview tab to see how your pull request will actually look like

  • Searched for similar pull requests

  • Compiled the code with Visual Studio

What is the purpose of your pull request?

  • Bug fix
  • Improvement
  • New feature

Description of your pull request and other information

增加IPv6 本地监听功能【纯IPv6,启用后不再监听IPv4】

  • 如果同时启用IPv4和IPv6 则需要考虑更多的问题。目前只做纯IPv4/IPv6
    针对#2407 的一种解决方案
    增加了isIPv6Enabled 标记,默认仍为关闭保持原样。
    image

当手动修改配置文件gui-config.json后 增加或者修改
isIPv6Enabled = true
后,将启用纯IPv6模式,原IPv4 监听的 1080 [tcp/udp] ss_privoxy随机 都将默认从IPv4切换到IPv6
0.0.0.0->[::],127.0.0.1->[::1]
切换后如图【允许其他设备接入】
image
关闭【允许其他设备接入】
image

存在的瑕疵:
目前有一个参数 LocalHost 会被写入到配置文件,但我不希望写入,这个需要解决。
代码中 LocalHost=>GetLocalHost() 是希望其他地方可以像localPort参数一样引用这个动态的localHost ,但对c#不熟悉所以不知道如何让 json 把这个 参数当成普通参数不进行json序列化。

@celeron533

This comment has been minimized.

Copy link
Collaborator

commented Jun 19, 2019

目前有一个参数 LocalHost 会被写入到配置文件,但我不希望写入,这个需要解决

Try
[JsonIgnore]

@celeron533

This comment has been minimized.

Copy link
Collaborator

commented Jun 26, 2019

如果同时启用IPv4和IPv6 则需要考虑更多的问题。目前只做纯IPv4/IPv6

So users can launch 2 instances, one for v4, and another for v6 ;)

@celeron533

This comment has been minimized.

Copy link
Collaborator

commented Jun 30, 2019

Thanks @Yifei0727 , there is one more thing need to take care about:

Sysproxy.SetIEProxy(true, true, "127.0.0.1:" + config.localPort.ToString(), null);

Otherwise, the system global proxy still remain v4 even user enabled the v6 feature.

@Yifei0727

This comment has been minimized.

Copy link
Contributor Author

commented Jul 1, 2019

这个地方使用localhost 比单纯的 127.0.0.1或者[::1]理论上要好吧,我觉得应该可以容错。
有空我先测试下。

@Yifei0727

This comment has been minimized.

Copy link
Contributor Author

commented Jul 2, 2019

改用localhost可以,在IPv4时自动等同于127.0.0.1,在IPv6时自动等同于[::1]

celeron533 added a commit to celeron533/shadowsocks-windows that referenced this pull request Jul 2, 2019
Support local IPv6 listener

# Conflicts:
#	shadowsocks-csharp/Model/Configuration.cs
@celeron533 celeron533 merged commit 561ba61 into shadowsocks:master Jul 2, 2019
1 check failed
1 check failed
continuous-integration/appveyor/pr AppVeyor was unable to build non-mergeable pull request
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.