Linux 端有没有一款支持分流、可以查看连接信息且方便修改规则的代理工具

2024-07-07 17:55:33 +08:00
 SlanWyf

想要实现的功能就是 linux 运行代理工具共享给局域网的其他终端。首先这个工具需要有 Ui 其次要能看到连接信息,比如那个域名匹配了那条规则有没有走代理,最后要能方便的修改规则。 类似于 openwrt 上的 openclash 。使用场景比如说,通过 UI 的连接信息可以看到 steam 在下载的时候有一个 SteamPipe 的域名走了代理,因为这是 steam 新的内容分发系统,之前规则没有匹配,默认走代理,那么我就在覆写规则中添加一条规则就可以了 但是 openwrt 的 docker 以及作为一台服务器来说肯定和 linux 没法比,而让 linux 以 docker 的方式运行 openwrt 也没必要,所以想问问有没有符合条件的 linux 代理工具

2416 次点击
所在节点    问与答
12 条回复
adrianzhang
2024-07-07 18:02:47 +08:00
Clash 起初就是运行在 Linux ,后来才有 OpenClash 运行在 OpenWRT
Pteromyini
2024-07-07 18:12:06 +08:00
clashverge
XiLingHost
2024-07-07 18:56:42 +08:00
感觉 v2raya 就不错,写规则很方便
如果只要本机代理不需要给其他设备开 socks/http 代理,或者只作为透明代理网关使用,可以试试 dae/daed
https://github.com/v2rayA/v2rayA
https://github.com/daeuniverse/dae
https://github.com/daeuniverse/daed
ptg2008
2024-07-07 19:22:03 +08:00
有的 我用 manjaro, pamac install --aur mihomo, 配置规则如下:
ptg2008
2024-07-07 19:24:50 +08:00
pr: &pr {type: select, proxies: [默认,香港,台湾,日本,新加坡,美国,其它地区,全部节点,自动选择,直连]}
p: &p {type: http, interval: 3600, health-check: {enable: true, url: https://www.gstatic.com/generate_204, interval: 300}}#

# url 里填写订阅,名称不能重复
proxy-providers:
xxxx:
<<: *p
path: ./xxxx.yaml
url: ""



ipv6: false
allow-lan: true
mixed-port: 7890
unified-delay: false
tcp-concurrent: true
external-controller: :9999
external-ui: /etc/mihomo/ui
external-ui-name: xd
# 因为 linux 用的是 server 版,所以 UI 指的是 yacd 等 dashboard
external-ui-url: "https://github.com/MetaCubeX/metacubexd/archive/refs/heads/gh-pages.zip"

geodata-mode: true
geodata-loader: standard
geo-auto-update: true
geo-update-interval: 24
geox-url:
geoip: "https://mirror.ghproxy.com/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip-lite.dat"
geosite: "https://mirror.ghproxy.com/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat"
mmdb: "https://mirror.ghproxy.com/https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/country-lite.mmdb"

find-process-mode: strict
global-client-fingerprint: chrome

sniffer:
enable: true
sniff:
HTTP:
ports: [80, 8080-8880]
override-destination: true
TLS:
ports: [443, 8443]
QUIC:
ports: [443, 8443]
skip-domain:
- '*.rc.sunlogin.net'

tun:
enable: true
stack: system
dns-hijack: ["any:53"]
auto-route: true
auto-detect-interface: true

dns:
enable: true
listen: :53
ipv6: false
enhanced-mode: redir-host
nameserver: ["tls://8.8.4.4", "tls://208.67.222.222"]
nameserver-policy:
"geosite:cn": ["202.96.128.166", "223.5.5.5"]

hosts:
'*.ptg.com': 192.168.66.55

proxies:
- name: "直连"
type: direct
udp: true
proxy-groups:
- {name: 默认, type: select, proxies: [自动选择, 直连, 香港, 台湾, 日本, 新加坡, 美国, 其它地区, 全部节点]}
- {name: YouTube, <<: *pr}
- {name: Google, <<: *pr}
- {name: OpenAI, <<: *pr}
- {name: 国内, type: select, proxies: [直连, 默认, 香港, 台湾, 日本, 新加坡, 美国, 其它地区, 全部节点, 自动选择]}
- {name: 其他, <<: *pr}
# 地区分组
- {name: 香港, type: select , include-all-providers: true, filter: "(?i)港|hk|hongkong|hong kong"}
- {name: 台湾, type: select , include-all-providers: true, filter: "(?i)台|tw|taiwan"}
- {name: 日本, type: select , include-all-providers: true, filter: "(?i)日|jp|japan"}
- {name: 美国, type: select , include-all-providers: true, filter: "(?i)美|us|unitedstates|united states"}
- {name: 新加坡, type: select , include-all-providers: true, filter: "(?i)(新|sg|singapore)"}
- {name: 其它地区, type: select , include-all-providers: true, filter: "(?i)^(?!.*(?:🇭🇰|🇯🇵|🇺🇸|🇸🇬|🇨🇳|港|hk|hongkong|台|tw|taiwan|日|jp|japan|新|sg|singapore|美|us|unitedstates)).*"}
- {name: 全部节点, type: select , include-all-providers: true}
- {name: 自动选择, type: url-test, include-all-providers: true, tolerance: 10}

rules:
- GEOIP,lan,直连,no-resolve
- GEOIP,private,直连,no-resolve
- GEOSITE,youtube,YouTube
- GEOSITE,google,Google
- GEOSITE,openai,OpenAI
- GEOSITE,cn,国内
- GEOSITE,geolocation-!cn,其他
- GEOIP,CN,国内
- MATCH,其他
ptg2008
2024-07-07 19:31:22 +08:00
不好意思 v2 的回复不太会用, 按 cmd+enter 以为换行, 直接发出去了, 我用 linux 发行版是 manjaro
1. pamac install --aur mihomo
2. sudo vim /etc/mihomo/config.yaml(在这里自己定义配置, 想必贴主应该熟悉这个配置文件, #5 是我的配置, 供参考)
3. sudo echo 1 > /proc/sys/net/ipv4/ip_forward(开启内核 ip v4 转发功能)
4. sudo systemctl enable --now mihomo.service
GrayXu
2024-07-07 19:57:49 +08:00
openclash 不就是 clash 的 client ,装个 clash 用 yacd 呗
zhanghua0
2024-07-08 08:42:57 +08:00
sing-box 有 clash api 支持,能用在 yacd 上,不过得自己写配置,核心本身不支持订阅
happyxhw101
2024-07-08 17:25:48 +08:00
SlanWyf
2024-07-08 22:19:59 +08:00
@adrianzhang
@GrayXu openclash 符合我条件是因为可以直接在 wrt 的页面补充规则覆盖配置文件中的规则,非常方便,不用编辑配置,clash 没用过不清楚可不可以做到类似的效果。
adrianzhang
2024-07-08 23:36:11 +08:00
@SlanWyf 如果能够提取出来 open clash 的页面 folder ,放到 clash 中能够实现同样效果。clash 和 openclash API 通用,只不过 openclash 定制了面板。
GrayXu
2024-07-09 10:04:04 +08:00
@SlanWyf #10 没有那么多场景需要频繁改动 rules 的,vim is all u need

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/1055471

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX