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

WIP feat: refactor wireguard outbound #1974

Closed
wants to merge 3 commits into from
Closed

Conversation

kunsonx
Copy link
Contributor

@kunsonx kunsonx commented Apr 20, 2023

重构 wireguard 出口

  1. 使用原始作者 wireguard-go 仓库做为依赖库.
  2. 在linux下创建 tun 设备来转发流量.
  3. 修复多线程并发情况下有可能创建多个tunnel的问题.

在 linux 尽可能使用系统的网络栈来确保内存使用与可靠的性能。
在这个实现中需要关闭 linux rp_filter.

不确定这么做是否合适,请看一看给一些意见建议参考一下。

@kunsonx
Copy link
Contributor Author

kunsonx commented Apr 20, 2023

另外我在测试 cloudflare 启用 ipv6 的情况下 wireguard 总是无法链接。
未找到原因(目前main分支也会)。

@yuhan6665
Copy link
Member

dragonfly bsd 构建坏了。。话说 dragonfly 真的有人用吗 如果原版不兼容干脆干掉 dragonfly 版本?@RPRX

@kunsonx
Copy link
Contributor Author

kunsonx commented Apr 21, 2023

我觉得是不需要的。可以先看看我这个改动是否合理吧?我认为使用系统网络栈是更好的。

@yuhan6665
Copy link
Member

@nekohasekai 指出你搬了一部分他的代码 要不我们加一个特别鸣谢

@kunsonx
Copy link
Contributor Author

kunsonx commented Apr 21, 2023

好的. 没有意见. 这个 MR 是否有意义?

@yuhan6665
Copy link
Member

我个人觉得很好 不过测试一下 结果发现

golang.zx2c4.com/wireguard/tun
/home/yuhan6665/go/pkg/mod/golang.zx2c4.com/wireguard@v0.0.0-20230325221338-052af4a8072b/tun/tun_linux.go:362:18: undefined: errors.Join
note: module requires Go 1.20

有没有可能兼容 1.19?主要是 go 1.20 目前还有一点兼容问题。。

@kunsonx
Copy link
Contributor Author

kunsonx commented Apr 23, 2023

这个模块 golang.zx2c4.com/wireguar 已经升级到 go 1.20, 我不建议回退这个依赖版本。

@yuhan6665
Copy link
Member

yuhan6665 commented Apr 23, 2023

等待解决 ng 上 go 1.20 dial 问题。。
已解决 可以合了

@RPRX
Copy link
Member

RPRX commented Aug 26, 2023

#2477 (comment)

@RPRX
Copy link
Member

RPRX commented Aug 26, 2023

需要 rebase 一下

@yuhan6665
Copy link
Member

感谢贡献!更新最新 合并了 #2716

@yuhan6665 yuhan6665 closed this Nov 12, 2023
@kunsonx kunsonx deleted the wg-sys-tun branch November 26, 2023 05:35
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.

3 participants