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

feat: implement port hopping #1064

Merged
merged 6 commits into from
Mar 8, 2024
Merged

feat: implement port hopping #1064

merged 6 commits into from
Mar 8, 2024

Conversation

keakon
Copy link

@keakon keakon commented Feb 26, 2024

No description provided.

@@ -82,6 +91,41 @@ func closeHysteria2(h *Hysteria2) {
}
}

func parsePorts(portStr string) (ports []uint16) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

common.utils中有NewUnsignedRanges可以直接用,不需要重新写一个新的

Copy link
Author

Choose a reason for hiding this comment

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

主要是这里接收的参数不是 []uint16,而是 string,格式是 port1,port2-port3,port4,需要解析成前者。

我看 transport/hysteria/conns/udp/hop.go 也是自己实现的 parsePorts

Copy link
Collaborator

Choose a reason for hiding this comment

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

那就先这样吧

@wwqgtxx wwqgtxx changed the title implement port hopping feat: implement port hopping Mar 8, 2024
@wwqgtxx wwqgtxx merged commit cc0f8e9 into MetaCubeX:Alpha Mar 8, 2024
H1JK pushed a commit that referenced this pull request Mar 8, 2024
* implement port hopping using sing and sing-quic

* 更新quic-go

* 更新sing

* Update go.sum

---------

Co-authored-by: wwqgtxx <wwqgtxx@gmail.com>
wwqgtxx added a commit that referenced this pull request Mar 8, 2024
* implement port hopping using sing and sing-quic

* 更新quic-go

* 更新sing

* Update go.sum

---------

Co-authored-by: wwqgtxx <wwqgtxx@gmail.com>
@YaeSakuraQvQ
Copy link

在使用固定端口时,更新到此版本会产生error: INTERNAL_ERROR (local): The system detected an invalid pointer address in attempting to use a pointer argument in a call.报错,无法使用

配置文件中有这种写法

p: &p {type: hysteria2, server: xxxx, port: xxxx, password: xxxxx}
proxies:
  - name: "1G"
    <<: *p
    up: "1 Gbps"
    down: "1 Gbps"
  - name: "500M"
    <<: *p
    up: "500 Mbps"
    down: "500 Mbps"
xxxxxx......

@wwqgtxx
Copy link
Collaborator

wwqgtxx commented Mar 8, 2024

@YaeSakuraQvQ 目前server为域名事暂时不可用,请等待修复

@keakon
Copy link
Author

keakon commented Mar 9, 2024

昨天好像忘记提交这个了,刚才切换分支时才发现
keakon@34e88d6

然后测了下老版本是支持域名的,估计是改成 ListenPacket 后解析有问题。我现在得出门了,晚上再研究。

@wwqgtxx
Copy link
Collaborator

wwqgtxx commented Mar 9, 2024

@keakon 明天晚上我来修吧,其实不是ListenPacket本身不支持域名,是WriteTo不支持。原来的Unbind是调用Write的,所以在DialContext的时候就已经解析完了

@wwqgtxx
Copy link
Collaborator

wwqgtxx commented Mar 10, 2024

@YaeSakuraQvQ @666dechaoge 你们可以试一下7ad37ca

@666dechaoge
Copy link

666dechaoge commented Mar 10, 2024

@YaeSakuraQvQ @666dechaoge 你们可以试一下7ad37ca

可以的,单端口域名的也能hy2节点能联通

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants