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 tun mode with sing-box #1191

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Add tun mode with sing-box #1191

wants to merge 2 commits into from

Conversation

wnxd
Copy link
Contributor

@wnxd wnxd commented Nov 22, 2023

Add tun mode with sing-box

Add tun mode with sing-box
Fixed the problem that DNS is invalid in TUN mode
@MarksonHon
Copy link
Contributor

MarksonHon commented Nov 23, 2023

is Singbox needed to be installed, or just use it's library?

OK, it's sure that you have used a full version of sing-box. However if you can switch to use sing -tun, it will be better in both packaging workflows and packages' size. Thanks for your work.

@MarksonHon
Copy link
Contributor

图片
If Singbox exits with errors, all proxy progress should be stopped too

@mzz2017
Copy link
Collaborator

mzz2017 commented Nov 23, 2023

现在是v2ray套singbox吗

@wnxd
Copy link
Contributor Author

wnxd commented Nov 23, 2023

现在是v2ray套singbox吗

是的,没有写配置转换的代码,只利用sing-box建立tun然后转发给v2ray

@mzz2017
Copy link
Collaborator

mzz2017 commented Nov 23, 2023

@wnxd 如果只是tun的话,v2ray-core现在是支持tun的

@wnxd
Copy link
Contributor Author

wnxd commented Nov 23, 2023

图片 If Singbox exits with errors, all proxy progress should be stopped too

I only tested it under macos.
Yes, it is indeed defective. I closed all proxies after I didn't deal with the unexpected exit of sing-box.

@MarksonHon
Copy link
Contributor

@mzz2017 印象中只支持Windows,所有如果能单独引入 sing-tun 是坠吼的

@mzz2017
Copy link
Collaborator

mzz2017 commented Nov 23, 2023

@wnxd 可以麻烦添加singbox的全支持吗,这一定是一个激动人心的特性

@wnxd
Copy link
Contributor Author

wnxd commented Nov 23, 2023

@wnxd 如果只是tun的话,v2ray-core现在是支持tun的

emmmm,我注意到介绍上只说了linux支持tun,在未阅读代码的情况下我以为macos不支持,所以就套了sing-box,毕竟sing-box在linux、macos与windows都支持的不错

@MarksonHon
Copy link
Contributor

MarksonHon commented Nov 23, 2023

@wnxd 如果只是tun的话,v2ray-core现在是支持tun的

emmmm,我注意到介绍上只说了linux支持tun,在未阅读代码的情况下我以为macos不支持,所以就套了sing-box,毕竟sing-box在linux、macos与windows都支持的不错

对的,所以现在有两个选择,要么让sing-box成为v2rayA所支持的第三个核心,从而减少套娃;或者只引入sing-tun,减少打包时的体积与依赖项

@wnxd
Copy link
Contributor Author

wnxd commented Nov 23, 2023

@wnxd 可以麻烦添加singbox的全支持吗,这一定是一个激动人心的特性

全支持的话,对于以前的代码肯能会有很大的改动,我可能需要些时间考虑下修改方案

@wnxd
Copy link
Contributor Author

wnxd commented Nov 23, 2023

@MarksonHon
我比较看好变成支持的第三个核心,不过从代码角度上来说可能会改动很大,得修改所有关于启动核心进程的代码与生成配置的代码

@Gaojianli
Copy link
Contributor

@MarksonHon 我比较看好变成支持的第三个核心,不过从代码角度上来说可能会改动很大,得修改所有关于启动核心进程的代码与生成配置的代码

第三个核心的变化会有点大,因为现在支持的两个核心毕竟从血缘上是相关的,配置文件大部分是兼容的,如果要支持sing-box可能要写很多if

@mzz2017
Copy link
Collaborator

mzz2017 commented Nov 23, 2023

@Gaojianli 工作量确实有点大。不如给v2raycore加win的tun支持?

@mzz2017
Copy link
Collaborator

mzz2017 commented Nov 23, 2023

@MarksonHon 引入 sing-tun 也是一个小成本方案

@MarksonHon
Copy link
Contributor

我比较看好变成支持的第三个核心,不过从代码角度上来说可能会改动很大,得修改所有关于启动核心进程的代码与生成配置的代码

是的,具体来说需要完成以下项目:
1、对 JSON 配置的生成进行抽象化(或者就一堆 if else),需要适配 v2ray(v5)、xray 与 sing-box 三种格式(至少要同时适配后两种)
2、自建 Debian 仓库加入 sing-box 的安装包,并设置为 v2rayA 的强制依赖项
3、Windows 安装包也需要加入 sing-box.exe
4、其他分发渠道也要加入 sing-box 二进制本身,或者将对应的包设为依赖

如果只引入 sing-tun(我个人偏向这种方案),那么工作量就会少得多:
1、Tun 是否启用 IPv6 需要遵循 v2rayA 里面的设置(由 --ipv6-support 进行控制)
2、Tun如果因为异常退出了,那么整个代理进程就得全部退出

相对而言工作量少得多

@wnxd
Copy link
Contributor Author

wnxd commented Nov 23, 2023

@MarksonHon
emmmm 我好像把问题搞复杂了,我是在windows上用着v2rayN的Tun模式效果还不错,就发现是基于sing-box实现的,就想着移植到MacOS上来(v2rayA)。
现在看来使用sing-tun可能比sing-box更方便一些。

@MarksonHon
Copy link
Contributor

@wnxd 好的,那就麻烦你继续修改了

@wnxd
Copy link
Contributor Author

wnxd commented Nov 24, 2023

@mzz2017
最新的源码在macOS下编译提示error Error: unable to get local issuer certificate
回滚到b664fba9d61848cf520ca5f44d4f28f8571dc9d6后正常编译

@MarksonHon
Copy link
Contributor

@wnxd 是在编译网页面板的时候出错还是编译Go部分的时候报错了

@wnxd
Copy link
Contributor Author

wnxd commented Nov 24, 2023

@MarksonHon
编译网络面板
应该是yarn无法下载某个包

@MarksonHon
Copy link
Contributor

@wnxd 我试了你的fork,能编译成功

@wnxd
Copy link
Contributor Author

wnxd commented Nov 24, 2023

@MarksonHon 我指的是v2rayA/v2rayA主分支最新代码编译报错 = =

@mzz2017
Copy link
Collaborator

mzz2017 commented Nov 26, 2023

@mzz2017

最新的源码在macOS下编译提示error Error: unable to get local issuer certificate

回滚到b664fba9d61848cf520ca5f44d4f28f8571dc9d6后正常编译

具体是哪个修改?

@bi4nbn
Copy link

bi4nbn commented Jan 27, 2024

静等大佬更新,我比较倾向sing-box做第三核心

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