Skip to content

Sockopt: Allow customSockopt work for Windows & Darwin #4576

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

Merged
merged 4 commits into from
Apr 18, 2025
Merged

Conversation

Fangliding
Copy link
Member

图一乐功能现在扩展到 Windows 和 Darwin
添加了不知道有没有用的system选项 和GOOS不匹配就跳过

@yuhan6665
Copy link
Member

I think system param is not needed? If user need a different setting for windows vs linux, they just need to have different config

@Fangliding
Copy link
Member Author

I think system param is not needed? If user need a different setting for windows vs linux, they just need to have different config

It's asked by #4504 (comment)

@xqzr
Copy link
Contributor

xqzr commented Apr 2, 2025

@Fangliding
Copy link
Member Author

简单原因是 lc.Control 传进来的是它的 ctrlNetwork 类型 在绝大多数时候系统都使用 ipv6 socket 操作 v4 地址 所以外面传来一个 udp6 导致判断错误(之前是用地址手动判断所以就没事)
现在改成一直使用地址判断 不会出错了
顺便之前改的udp还传个空地址进去 明明目标地址就在下面(

@xqzr
Copy link
Contributor

xqzr commented Apr 3, 2025

可能要再加个 proto ,有些选项在 UDP 调用会失败

[Info] [210361720] app/dispatcher: default route for udp:[2606:4700::]:80
[Debug] [210361720] transport/internet: dialing to udp:[2606:4700::]:80
from [::1]:56594 accepted udp:[2606:4700::]:80
[Info] [210361720] transport/internet: transport/internet: failed to set CustomSockoptInt101An invalid argument was supplied.failed to apply socket options
[Info] [210361720] proxy/freedom: connection opened to udp:[2606:4700::]:80, local endpoint [::]:56595, remote endpoint [2606:4700::]:80

CustomSockoptInt101An

CustomSockoptInt 10 1 An

@RPRX
Copy link
Member

RPRX commented Apr 18, 2025

@xqzr network 有的

@RPRX RPRX changed the title Sockopt: Add custom sockopt on Windows & Darwin Sockopt: Allow customSockopt work for Windows & Darwin Apr 18, 2025
@RPRX
Copy link
Member

RPRX commented Apr 18, 2025

顺便之前改的udp还传个空地址进去 明明目标地址就在下面(

因为所有 applyOutboundSocketOptions() 的实现根本就没用到传入的 address,我为了标明它没被用到就写了 ""

改成现在这样也无所谓,反正没用到

@RPRX RPRX merged commit 5f3ae64 into main Apr 18, 2025
70 checks passed
@RPRX
Copy link
Member

RPRX commented Apr 18, 2025

没看代码,先合了,反正 sockopt 用得也不多,交给用户测试吧

@RPRX RPRX deleted the custom-sockopt branch April 30, 2025 17:59
@xqzr
Copy link
Contributor

xqzr commented May 4, 2025

@xqzr network 有的

我混淆了...需要的是 IP 版本。有些选项只能在 IPv6 或 IPv4 中调用,跨 IP 版本调用会失败(立即返回)

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.

4 participants