V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
SlanWyf
V2EX  ›  问与答

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

  •  
  •   SlanWyf · 62 天前 · 1226 次点击
    这是一个创建于 62 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

    第 1 条附言  ·  62 天前
    因为 linux 用的是 server 版,所以 UI 指的是 yacd 等 dashboard
    12 条回复    2024-07-09 10:04:04 +08:00
    adrianzhang
        1
    adrianzhang  
       62 天前
    Clash 起初就是运行在 Linux ,后来才有 OpenClash 运行在 OpenWRT
    Pteromyini
        2
    Pteromyini  
       62 天前
    clashverge
    XiLingHost
        3
    XiLingHost  
       62 天前
    感觉 v2raya 就不错,写规则很方便
    如果只要本机代理不需要给其他设备开 socks/http 代理,或者只作为透明代理网关使用,可以试试 dae/daed
    https://github.com/v2rayA/v2rayA
    https://github.com/daeuniverse/dae
    https://github.com/daeuniverse/daed
    ptg2008
        4
    ptg2008  
       62 天前
    有的 我用 manjaro, pamac install --aur mihomo, 配置规则如下:
    ptg2008
        5
    ptg2008  
       62 天前
    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
        6
    ptg2008  
       62 天前
    不好意思 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
        7
    GrayXu  
       62 天前
    openclash 不就是 clash 的 client ,装个 clash 用 yacd 呗
    zhanghua0
        8
    zhanghua0  
       61 天前
    sing-box 有 clash api 支持,能用在 yacd 上,不过得自己写配置,核心本身不支持订阅
    happyxhw101
        9
    happyxhw101  
       61 天前
    SlanWyf
        10
    SlanWyf  
    OP
       61 天前
    @adrianzhang
    @GrayXu openclash 符合我条件是因为可以直接在 wrt 的页面补充规则覆盖配置文件中的规则,非常方便,不用编辑配置,clash 没用过不清楚可不可以做到类似的效果。
    adrianzhang
        11
    adrianzhang  
       61 天前
    @SlanWyf 如果能够提取出来 open clash 的页面 folder ,放到 clash 中能够实现同样效果。clash 和 openclash API 通用,只不过 openclash 定制了面板。
    GrayXu
        12
    GrayXu  
       60 天前
    @SlanWyf #10 没有那么多场景需要频繁改动 rules 的,vim is all u need
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1124 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 23:44 · PVG 07:44 · LAX 16:44 · JFK 19:44
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.