zachary99
V2EX  ›  问与答

clash 这个规则怎么写

  •  
  •   zachary99 · Jul 21, 2023 · 2514 views
    This topic created in 1111 days ago, the information mentioned may be changed or developed.

    有没有大佬可以指教一下。 我想限制某一个 ip ,YouTube 不走代理,google ,microsoft 强制走代理,主要是 microsoft 域名太多了,最好能直接调用 clash 里 prodiver 的文件

    7 replies    2023-07-21 16:27:32 +08:00
    vcn8yjOogEL
        1
    vcn8yjOogEL  
       Jul 21, 2023 via Android
    靠前的规则优先,所以在顶层加上你需要的规则就好了

    想批量添加可以用 geosite 或 provider(需要 Meta/专有核心)实现
    hahasong
        2
    hahasong  
       Jul 21, 2023   ❤️ 1
    - IP-CIDR, x.x.x.x/24, DIRECT
    - GEOSITE, youtube, DIRECT
    - GEOSITE, microsoft, Proxy
    - GEOIP, CN, DIRECT
    - MATCH, Proxy
    gdrk
        3
    gdrk  
       Jul 21, 2023
    借地刚好问下怎么让微软系不走代理,比如商店和各类微软官方的应用,开了 tun 模式好像是强制走代理了
    Goalonez
        4
    Goalonez  
       Jul 21, 2023
    是指这样吗?

    rule-providers:
    Google:
    type: http
    behavior: classical
    url: 规则订阅地址
    interval: 172800
    path: ./remote/Google.yaml
    YouTube:
    type: http
    behavior: classical
    url: 规则订阅地址
    interval: 172800
    path: ./remote/YouTube.yaml
    rules:
    - RULE-SET,Google,Proxy
    - RULE-SET,YouTube,DIRECT
    Goalonez
        5
    Goalonez  
       Jul 21, 2023
    @Goalonez #4 不知道为什么空格没了....
    zachary99
        6
    zachary99  
    OP
       Jul 21, 2023
    @Goalonez 这几个规则应用于某个局域网 ip ,是咋操作的
    qiaoqiao1235
        7
    qiaoqiao1235  
       Jul 21, 2023
    你这多个组合条件有两个办法:
    1.clash premium 的 script 方式
    2.clash meta 的逻辑规则

    建议用第二个,稍微简单点,类似
    AND,((SRC-IP-CIDR, xx.xx.xx.xxx), (GEOSITE, youtube)), DIRECT
    AND,((SRC-IP-CIDR, xx.xx.xx.xxx), or((GEOSITE, google), (GEOSITE, microsoft ))), PROXY

    https://clash-meta.wiki/config/rules/logic/#and
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   964 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 20:07 · PVG 04:07 · LAX 13:07 · JFK 16:07
    ♥ Do have faith in what you're doing.