arkrz / v2sub Goto Github PK
View Code? Open in Web Editor NEW用于 linux 下订阅 v2ray 的小工具。
用于 linux 下订阅 v2ray 的小工具。
修改入站的http和socket5端口
有些选项一般只会改一次, 除了命令行参数里设置, 还可以在第一次运行的时候进行(自定义参数也有一个确认, 让普通用户保持默认)配置, 比如是否按延迟排序, 端口设置等
目前已经有要求用户输入订阅链接的相关代码了, 改起来会更容易些
if cfg.SubUrl == "" {
fmt.Print("输入订阅地址:")
_, _ = fmt.Scan(&cfg.SubUrl)
} else {
fmt.Printf("订阅地址: %s\n", cfg.SubUrl)
}
用户那边像这样
输入订阅地址:[用户输入https://xx.com/xx]
是否自定义参数(y或n, 默认:n) [用户输入 y]
http端口(默认:1080) [用户输入10809]
sock端口(默认:1081) [用户输入enter]
是否按延迟排序(y或n, 默认:y) [用户输入enter]
在选择节点之后,重启v2ray服务失败。exit status 5
sudo v2sub
没这个文件啊 执行不了
v1.2.0
因为环境是docker云服务无法更改一下环境,就无法使用systemctl管理,我使用绝对路径之后
fmt.Println("重启 v2ray 服务...")
if err = exec.Command("systemctl", "restart", "v2ray.service").Run(); err != nil {
fmt.Printf("重启失败: %v\n", err)
return
}
}
但是运行显示成功,但是查看端口没有
运行信息:
输入节点序号:26
输入节点序号:26
[🇺🇸 美国01-VIP] Ping: -1ms
重启 v2ray 服务...
开始监听...
socks://127.0.0.1:7891
http://127.0.0.1:7890
All done.
再次查看程序都跑着就是无法监听端口
输入节点序号:12
[🇭🇰 香港10-流媒体] Ping: 0ms
重启 v2ray 服务...
开始监听...
socks://127.0.0.1:10808
http://127.0.0.1:10809
All done.
root@sa0:~/data/v2sub# ss -tuln | grep LISTEN
tcp LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
tcp LISTEN 0 128 0.0.0.0:6007 0.0.0.0:*
tcp LISTEN 0 128 0.0.0.0:8888 0.0.0.0:*
tcp LISTEN 0 128 [::]:22 [::]:*
tcp LISTEN 0 4096 *:2022 *:*
root@autodl-container-9cdf118dfa-73294360:~/data/v2sub# ps -ef | grep v2ray
root 22998 6869 0 Nov30 pts/0 00:00:00 screen -S v2ray
root 22999 22998 0 Nov30 ? 00:00:00 SCREEN -S v2ray
root 39588 29138 0 00:20 pts/13 00:00:00 grep --color=auto v2ray
root@sa:~/data/v2sub# ./v2sub -help
不好意思,我好像没找到这个功能在哪里
我设置http-proxy
等环境变量让系统里的程序自动使用v2ray代理, 路由规则的是绕过大陆.
当节点不可用的时候, 我用本程序v2sub -sub
更新订阅[1]设置代理的时候却发现因为节点不可用, 且程序走了代理, 无法获取在境外服务器上的订阅信息.
[1]默认不使用最新的订阅, 这可能是你没发现问题的原因, 因为有可能出现缓存订阅里的节点全部失效的情况, 因此这个issue是需要解决的
我的解决办法是在
func GetSub(url string, ch chan<- []string)
函数第一行加上
http.DefaultTransport.(*http.Transport).Proxy = nil
如题
trojan需要单独安装,而且trojan和v2ray同时运行(好像程序代码里运行trojan服务时不会关闭v2ray)要考虑端口占用的问题,如果能过滤掉trojan节点就不用管这个了
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.