YukiCoco / ToMoon

基于 SteamOS 定制的网络工具,自动配置 TUN 模式加速游戏,网络代理。
BSD 3-Clause "New" or "Revised" License
941 stars 40 forks source link

如何在to moon中自定义规则? #38

Closed LTJ233 closed 1 year ago

LTJ233 commented 1 year ago

我希望可以绕过我的host,但to moon的界面和正常clash不一样,在规则界面我找不到添加新规则的方法,请问该如何操作?

FixJA commented 1 year ago

把你的代理链接添加到配置文件中,通过tomoon导入配置文件就可以了,这个是我写的配置文件,如果在tomoon插件运行失败一般是规则下载失败,查看日志把下载失败的规则复制到/root/.config/clash/ruleset目录下

port: 7890
socks-port: 7891
redir-port: 7892
allow-lan: false
mode: Rule
log-level: silent
external-controller: 127.0.0.1:9090
secret: ""

# 节点配置文件统一存放在 ./profiles/proxies/ 目录中
proxy-providers:
# 从链接导入的配置文件(支持多个Clash 订阅链接)
  cnix:
    type: http
    path: ./profiles/proxies/cnix.yaml
    url: http://www.gstatic.com/generate_204
    interval: 3600

# 从本地导入的 clash 配置文件
#  cnix:
#    type: file
#    path: ./profiles/proxies/cnix.yaml
#    health-check:
#      enable: true
#      url: http://www.gstatic.com/generate_204
#      interval: 3600

proxy-groups:
  - name: 🔯 代理模式 
    type: select
    proxies:
      - 绕过大陆丨黑名单(GFWlist) # 黑名单模式,意为「只有命中规则的网络流量,才使用代理」
      - 绕过大陆丨白名单(Whitelist) # 白名单模式,意为「没有命中规则的网络流量,统统使用代理」

  - name: 🔰 选择节点 
    type: select
    use:
      - cnix
    proxies:
      - DIRECT

  - name: ⏱️ 自动选择
    type: url-test
    url: http://www.gstatic.com/generate_204
    interval: 1800
    use:
      - cnix

  - name: 🍎 苹果服务 
    type: select
    proxies:
      - DIRECT
      - PROXY 

  - name: 🪟 微软服务 
    type: select
    proxies:
      - DIRECT
      - PROXY
      - 其他

  - name: 🗑️ 漏网之鱼 
    type: select
    proxies:
      - DIRECT
      - PROXY

  - name: 🛑 广告拦截
    type: select
    proxies:
      - DIRECT
      - REJECT

  - name: PROXY
    type: select
    proxies:
      - 🔰 选择节点  
      - ⏱️ 自动选择

  - name: 其他
    type: select 
    use:
      - cnix

  - name: 绕过大陆丨黑名单(GFWlist)
    type: url-test
    url: http://www.gstatic.com/generate_204
    interval: 86400
    proxies:
      - DIRECT

  - name: 绕过大陆丨白名单(Whitelist)
    type: url-test
    url: http://www.gstatic.com/generate_204
    interval: 86400
    proxies:
      - PROXY

  # 策略组示例
       # - name: 分组名
         # type: select       # 手动选点   
               # url-test     # 自动选择延迟最低的节点
               # fallback     # 节点故障时自动切换下一个
               # laod-balance # 均衡使用分组内的节点
         # url: http://www.gstatic.com/generate_204 # 测试地址 非select类型分组必要
         # interval: 300 # 自动测试间隔时间,单位秒 非select类型分组必要
         # tolerance: 50 # 允许的偏差,节点之间延迟差小于该值不切换 非必要
         # proxies:  
           # - 节点名称或其他分组套娃

# 分流规则
# 规则由上往下遍历,如上面规则已经命中,则不再往下处理
rules:
  - RULE-SET,LocalAreaNetwork,DIRECT
  - RULE-SET,ChinaCompanyIp,DIRECT
  - RULE-SET,ChinaIp,DIRECT        
  - RULE-SET,ChinaDomain,DIRECT
  - RULE-SET,ChinaMedia,DIRECT
  - RULE-SET,Download,DIRECT 
  - RULE-SET,GoogleCN,DIRECT
  - RULE-SET,SteamCN,DIRECT
  - RULE-SET,GameDownload,DIRECT        
  - RULE-SET,Microsoft,🪟 微软服务
  - RULE-SET,Apple,🍎 苹果服务         
  - RULE-SET,OpenAi,其他                                 
  - RULE-SET,BanAD,🛑 广告拦截
  - RULE-SET,BanEasyList,🛑 广告拦截
  - RULE-SET,Steam,PROXY
  - RULE-SET,ProxyGFWlist,PROXY 
  - RULE-SET,ProxyMedia,PROXY  
  - GEOIP,,DIRECT
  - GEOIP,CN,DIRECT
  - MATCH,🗑️ 漏网之鱼 # 规则之外的

rule-providers:
  # 广告域名列表
  BanAD: 
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/BanAD.yaml"
    path: ./ruleset/BanAD.yaml
    interval: 86400

  BanEasyList: 
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/BanEasyList.yaml"
    path: ./ruleset/BanEasyList.yaml
    interval: 86400
  # 直连域名列表
  ChinaCompanyIp: 
    type: http
    behavior: ipcidr
    url: "https://cdn.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/ChinaCompanyIp.yaml"
    path: ./ruleset/ChinaCompanyIp.yaml
    interval: 86400 

  ChinaDomain: 
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/ChinaDomain.yaml"
    path: ./ruleset/ChinaDomain.yaml
    interval: 86400

  ChinaMedia: 
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/ChinaMedia.yaml"
    path: ./ruleset/ChinaMedia.yaml
    interval: 86400

  Download: 
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/Download.yaml"
    path: ./ruleset/Download.yaml
    interval: 86400  

  ChinaIp: 
    type: http
    behavior: ipcidr
    url: "https://cdn.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/ChinaIp.yaml"
    path: ./ruleset/ChinaIp.yaml
    interval: 86400 

  LocalAreaNetwork: 
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/LocalAreaNetwork.yaml"
    path: ./ruleset/LocalAreaNetwork.yaml
    interval: 86400 
  #代理域名
  ProxyGFWlist: 
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/ProxyGFWlist.yaml"
    path: ./ruleset/ProxyGFWlist.yaml
    interval: 86400 

  ProxyMedia: 
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/ProxyMedia.yaml"
    path: ./ruleset/ProxyMedia.yaml
    interval: 86400
  #特殊规则
  Apple: 
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/Ruleset/Apple.yaml"
    path: ./ruleset/Apple.yaml
    interval: 86400 

  GoogleCN: 
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/Ruleset/GoogleCN.yaml"
    path: ./ruleset/GoogleCN.yaml
    interval: 86400 

  OpenAi: 
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/Ruleset/OpenAi.yaml"
    path: ./ruleset/OpenAi.yaml
    interval: 86400 

  Microsoft: 
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/Ruleset/Microsoft.yaml"
    path: ./ruleset/Microsoft.yaml
    interval: 86400

  Steam: 
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/Ruleset/Steam.yaml"
    path: ./ruleset/Steam.yaml
    interval: 86400 

  SteamCN: 
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/Ruleset/SteamCN.yaml"
    path: ./ruleset/SteamCN.yaml
    interval: 86400 

  GameDownload: 
    type: http
    behavior: classical
    url: "https://cdn.jsdelivr.net/gh/ACL4SSR/ACL4SSR@master/Clash/Providers/Ruleset/GameDownload.yaml"
    path: ./ruleset/GameDownload.yaml
    interval: 86400