DustinWin / dustinwin.github.io

Clash 和 sing-box 教程合集——安装、配置、自定义规则、DNS 分流
http://proxy-tutorials.dustinwin.top/
MIT License
1.21k stars 139 forks source link

【配置优化相关】关闭 mihomo 内核 tun 模式,使用 tproxy 模式 #42

Closed KisThFir closed 2 months ago

KisThFir commented 2 months ago

因在 Android 上使用 mihomo 内核 tun 模式,无法正常观看 ipv6 直播源,后刷入 box4magisk 模块,改用 tproxy 模式一切正常。 但不知道是不是错觉,浏览网页时没有 tun 模式顺畅。 我的配置如下:

mixed-port: 7890
redir-port: 7891
tproxy-port: 1536
allow-lan: true
mode: Rule
log-level: error
geodata-mode: true
geodata-loader: standard
unified-delay: true
tcp-concurrent: true
ipv6: true
external-controller: 127.0.0.1:9394
external-ui: ./dashboard/Meta #Yacd

enable-process: true
find-process-mode: always
keep-alive-interval: 1800
global-client-fingerprint: chrome
global-ua: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Mobile Safari/537.36

geo-auto-update: true
geo-update-interval: 24
geox-url:
  geoip: "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat"
  geosite: "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat"
  mmdb: "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/country.mmdb"

profile:
  store-selected: true
  store-fake-ip: true

sniffer:
  enable: true
  parse-pure-ip: true
  sniff: {HTTP: {ports: [80, 8080-8880], override-destination: true}, TLS: {ports: [443, 8443]}, QUIC: {ports: [443, 8443]}}
  skip-domain: ['Mijia Cloud']

dns:
  enable: true
  prefer-h3: true
  ipv6: true
  listen: 0.0.0.0:1053
  fake-ip-range: 198.18.0.0/15
  enhanced-mode: fake-ip
  fake-ip-filter:
    - '*.lan'
    - '*.localdomain'
    - '*.example'
    - '*.invalid'
    - '*.localhost'
    - '*.test'
    - '*.local'
    - '*.home.arpa'
    - 'time.*.com'
    - 'time.*.gov'
    - 'time.*.edu.cn'
    - 'time.*.apple.com'
    - 'time-ios.apple.com'
    - 'time1.*.com'
    - 'time2.*.com'
    - 'time3.*.com'
    - 'time4.*.com'
    - 'time5.*.com'
    - 'time6.*.com'
    - 'time7.*.com'
    - 'ntp.*.com'
    - 'ntp1.*.com'
    - 'ntp2.*.com'
    - 'ntp3.*.com'
    - 'ntp4.*.com'
    - 'ntp5.*.com'
    - 'ntp6.*.com'
    - 'ntp7.*.com'
    - '*.time.edu.cn'
    - '*.ntp.org.cn'
    - '+.pool.ntp.org'
    - 'time1.cloud.tencent.com'
    - 'music.163.com'
    - '*.music.163.com'
    - '*.126.net'
    - 'musicapi.taihe.com'
    - 'music.taihe.com'
    - 'songsearch.kugou.com'
    - 'trackercdn.kugou.com'
    - '*.kuwo.cn'
    - 'api-jooxtt.sanook.com'
    - 'api.joox.com'
    - 'joox.com'
    - 'y.qq.com'
    - '*.y.qq.com'
    - 'streamoc.music.tc.qq.com'
    - 'mobileoc.music.tc.qq.com'
    - 'isure.stream.qqmusic.qq.com'
    - 'dl.stream.qqmusic.qq.com'
    - 'aqqmusic.tc.qq.com'
    - 'amobile.music.tc.qq.com'
    - '*.xiami.com'
    - '*.music.migu.cn'
    - 'music.migu.cn'
    - '+.msftconnecttest.com'
    - '+.msftncsi.com'
    - 'localhost.ptlogin2.qq.com'
    - 'localhost.sec.qq.com'
    - '+.qq.com'
    - '+.tencent.com'
    - '+.srv.nintendo.net'
    - '*.n.n.srv.nintendo.net'
    - '+.stun.playstation.net'
    - 'xbox.*.*.microsoft.com'
    - '*.*.xboxlive.com'
    - 'xbox.*.microsoft.com'
    - 'xnotify.xboxlive.com'
    - '+.battlenet.com.cn'
    - '+.wotgame.cn'
    - '+.wggames.cn'
    - '+.wowsgame.cn'
    - '+.wargaming.net'
    - 'proxy.golang.org'
    - 'stun.*.*'
    - 'stun.*.*.*'
    - '+.stun.*.*'
    - '+.stun.*.*.*'
    - '+.stun.*.*.*.*'
    - '+.stun.*.*.*.*.*'
    - 'heartbeat.belkin.com'
    - '*.linksys.com'
    - '*.linksyssmartwifi.com'
    - '*.router.asus.com'
    - 'mesu.apple.com'
    - 'swscan.apple.com'
    - 'swquery.apple.com'
    - 'swdownload.apple.com'
    - 'swcdn.apple.com'
    - 'swdist.apple.com'
    - 'lens.l.google.com'
    - 'stun.l.google.com'
    - 'na.b.g-tun.com'
    - '+.nflxvideo.net'
    - '*.square-enix.com'
    - '*.finalfantasyxiv.com'
    - '*.ffxiv.com'
    - '*.ff14.sdo.com'
    - 'ff.dorado.sdo.com'
    - '*.mcdn.bilivideo.cn'
    - '+.media.dssott.com'
    - 'shark007.net'
    - 'Mijia Cloud'
    - '+.cmbchina.com'
    - '+.cmbimg.com'
    - 'adguardteam.github.io'
    - 'adrules.top'
    - 'anti-ad.net'
    - 'local.adguard.org'
    - 'static.adtidy.org'
    - '+.sandai.net'
    - '+.n0808.com'
    - '+.3gppnetwork.org'
    - '+.uu.163.com'
    - 'ps.res.netease.com'
  nameserver:
    - 'https://223.5.5.5/dns-query#h3=true'
    - https://1.12.12.12/dns-query

tun:
  enable: false
  device: tun0
  stack: system
  dns-hijack:
    - "any:53"
    - "tcp://any:53"
  auto-route: true
  auto-detect-interface: true

  p: &p
    {type: http, interval: 7200, health-check: {enable: true, url: https://www.gstatic.com/generate_204, interval: 600}}
  u: &u
    use:
    - provider1

proxy-providers:
  provider1:
    <<: *p
    url: "自用"
    path: ./proxy_providers/subscribe1.yaml
    #注意!如果您的订阅链接中带有“&”字符,请删掉.
proxy-groups:
  - {name: 🔒 手动切换, type: select, use: [provider1]}
  - {name: 🚀 节点选择, type: select, proxies: [♻️ 自动切换,🔒 手动切换,🐱,🐶,❤️ 负载均衡]}
  - {name: 🐟 漏网之鱼, type: select, proxies: [🚀 节点选择,🎯 全球直连]}
  - {name: 📈 网络测试, type: select, proxies: [❤️ 负载均衡,🚀 节点选择,🎯 全球直连]}
  - {name: 📢 谷歌FCM, type: select, proxies: [🎯 全球直连, 🐱, 🚀 节点选择, 🔒 手动切换]}
  - {name: 📖 自建列表, type: select, proxies: [🐱,🔒 手动切换,🐶]}
  - {name: 🤖 OpenAI, type: select, proxies: [🐱,🔒 手动切换,🚀 节点选择,🐶]}
  - {name: 🎬 油管视频, type: select, proxies: [❤️ 负载均衡,🚀 节点选择,🔒 手动切换]}
  - {name: 🇬 谷歌服务, type: select, proxies: [🎯 全球直连,🚀 节点选择,🔒 手动切换]}
  - {name: 📲 电报信息, type: select, proxies: [🚀 节点选择,🔒 手动切换]}
  - {name: 🖥️ 奈飞视频, type: select, proxies: [🚀 节点选择,🔒 手动切换]}
  - {name: 🪟 微软服务, type: select, proxies: [🎯 全球直连,🚀 节点选择,🔒 手动切换]}
  - {name: 🍎 苹果服务, type: select, proxies: [🎯 全球直连,🚀 节点选择,🔒 手动切换]}
  - {name: 🛑 广告拦截, type: select, proxies: [REJECT,🎯 全球直连]}
  - {name: 🎯 全球直连, type: select, proxies: [DIRECT]}
  - {name: ❤️ 负载均衡, type: load-balance, strategy: round-robin, include-all-providers: true}
  - {name: ♻️ 自动切换, include-all-providers: true, tolerance: 50, type: url-test}

proxies: 
  - name: "🐱"
    type: vmess
    server: 🐱
    port: 🐱
    uuid: 🐱
    alterId: 🐱
    cipher: auto
    udp: true
    tls: true
    servername: 🐱
    network: ws
    ws-opts:
      path: /photo
      headers:
        Host: 🐱
  - name: "🐶"
    type: vmess
    server: 🐶
    port: 🐶
    uuid: 🐶
    alterId: 🐶
    cipher: auto
    udp: true
    servername: 🐶
    network: h2
    tls: true
    h2-opts:
      host:
        - 🐶
      path: /cache

rule-providers:
  Balance:
    type: http
    behavior: classical
    format: text
    path: ./rule/Balance.list
    url: "自用"
    interval: 86400

  App:
    type: http
    behavior: classical
    format: text
    path: ./rule/App.list
    url: "自用"
    interval: 86400

  GoogleFCM:
    type: http
    behavior: classical
    format: text
    path: ./rule/GoogleFCM.list
    url: "https://raw.gitmirror.com/ACL4SSR/ACL4SSR/master/Clash/Ruleset/GoogleFCM.list"
    interval: 86400

  WechatFCM:
    type: http
    behavior: classical
    format: text
    path: ./rule/WechatFCM.list
    url: "https://raw.gitmirror.com/Snowflake-Pink/Files4Converter/master/Clash/WechatFCM.list"
    interval: 86400

  networktest:
    type: http
    behavior: classical
    format: text
    path: ./rule/networktest.list
    url: "https://raw.gitmirror.com/DustinWin/ruleset_geodata/clash-ruleset/networktest.list"
    interval: 86400

  ChinaCompanyIp:
    type: http
    behavior: classical
    format: text
    path: ./rule/ChinaCompanyIp.list
    url: "https://raw.gitmirror.com/ACL4SSR/ACL4SSR/master/Clash/ChinaCompanyIp.list"
    interval: 86400

  Costom:
    type: http
    behavior: classical
    format: text
    path: ./rule/Costom.list
    url: "自用"
    interval: 86400

  China:
    type: http
    behavior: classical
    format: text
    path: ./rule/China.list
    url: "自用"
    interval: 86400

  Telegram:
    type: http
    behavior: ipcidr
    format: text
    path: ./rule/telegramip.list
    url: "https://raw.gitmirror.com/DustinWin/ruleset_geodata/clash-ruleset/telegramip.list"
    interval: 86400

  Youtube:
    type: http
    behavior: classical
    format: text
    path: ./rule/YouTube.list
    url: "https://raw.gitmirror.com/blackmatrix7/ios_rule_script/master/rule/Clash/YouTube/YouTube.list"
    interval: 86400

  Google:
    type: http
    behavior: domain
    format: text
    path: ./rule/google-cn.list
    url: "https://raw.gitmirror.com/DustinWin/ruleset_geodata/clash-ruleset/google-cn.list"
    interval: 86400

  Microsoft:
    type: http
    behavior: domain
    format: text
    path: ./rule/microsoft-cn.list
    url: "https://raw.gitmirror.com/DustinWin/ruleset_geodata/clash-ruleset/microsoft-cn.list"
    interval: 86400

  Apple:
    type: http
    behavior: domain
    format: text
    path: ./rule/apple-cn.list
    url: "https://raw.gitmirror.com/DustinWin/ruleset_geodata/clash-ruleset/apple-cn.list"
    interval: 86400

  Openai:
    type: http
    behavior: domain
    format: text
    path: ./rule/ai.list
    url: "https://raw.gitmirror.com/DustinWin/ruleset_geodata/clash-ruleset/ai.list"
    interval: 86400

  Netflix:
    type: http
    behavior: classical
    format: yaml
    path: ./rule/Netflix.yaml
    url: "https://raw.gitmirror.com/MoGuangYu/rules/main/Home/Netflix.yaml"
    interval: 86400

rules:
  - AND,((PROCESS-NAME,mihomo),(NOT,((IN-TYPE,inner)))),REJECT
  - AND,((PROCESS-NAME,clash),(NOT,((IN-TYPE,inner)))),REJECT
  - RULE-SET,App,🎯 全球直连
  - RULE-SET,GoogleFCM,📢 谷歌FCM
  - RULE-SET,WechatFCM,📢 谷歌FCM
  - RULE-SET,Balance,❤️ 负载均衡
  - RULE-SET,China,🎯 全球直连
  - RULE-SET,Costom,📖 自建列表
  - RULE-SET,networktest,📈 网络测试
  - RULE-SET,Youtube,🎬 油管视频
  - RULE-SET,Netflix,🖥️ 奈飞视频
  - RULE-SET,Google,🇬 谷歌服务
  - RULE-SET,Apple,🍎 苹果服务
  - RULE-SET,Microsoft,🪟 微软服务
  - RULE-SET,Openai,🤖 OpenAI
  - GEOSITE,category-ads-all,🛑 广告拦截
  - GEOSITE,CN,🎯 全球直连
  - RULE-SET,ChinaCompanyIp,🎯 全球直连
  - RULE-SET,Telegram,📲 电报信息,no-resolve
  - GEOIP,private,🎯 全球直连,no-resolve
  - GEOIP,CN,🎯 全球直连,no-resolve
  - MATCH,🐟 漏网之鱼
DustinWin commented 2 months ago

配置上没啥问题,为保证兼容性,- GEOIP,CN,🎯 全球直连,no-resolve 去掉 no-resolve

KisThFir commented 2 months ago

@DustinWin 好的谢谢大佬👌🏻,你的教程帮了很多。

这套配置虽然可以正常观看 ipv6 直播源,但 ip 形式的 ipv6 源在 metacubexd 面板里面看不到相关活动连接,像被内核绕过了一样,ipv4 的正常。

反之如果是域名地址的源解析出来的 ipv6,就能看到活动连接。

这个问题怎么优化。

DustinWin commented 2 months ago

@DustinWin 好的谢谢大佬👌🏻,你的教程帮了很多。

这套配置虽然可以正常观看 ipv6 直播源,但 ip 形式的 ipv6 源在 metacubexd 面板里面看不到相关活动连接,像被内核绕过了一样,ipv4 的正常。

反之如果是域名地址的源解析出来的 ipv6,就能看到活动连接。

这个问题怎么优化。

只搜 IPv6 前缀部分呢?话说老盯着面板干嘛~

KisThFir commented 2 months ago

@DustinWin 好的谢谢大佬👌🏻,你的教程帮了很多。 这套配置虽然可以正常观看 ipv6 直播源,但 ip 形式的 ipv6 源在 metacubexd 面板里面看不到相关活动连接,像被内核绕过了一样,ipv4 的正常。 反之如果是域名地址的源解析出来的 ipv6,就能看到活动连接。 这个问题怎么优化。

只搜 IPv6 前缀部分呢?话说老盯着面板干嘛~

也搜不到,完全无痕~

DustinWin commented 2 months ago

@DustinWin 好的谢谢大佬👌🏻,你的教程帮了很多。 这套配置虽然可以正常观看 ipv6 直播源,但 ip 形式的 ipv6 源在 metacubexd 面板里面看不到相关活动连接,像被内核绕过了一样,ipv4 的正常。 反之如果是域名地址的源解析出来的 ipv6,就能看到活动连接。 这个问题怎么优化。

只搜 IPv6 前缀部分呢?话说老盯着面板干嘛~

也搜不到,完全无痕~

那就不清楚了。我目前在用 sing-box,这边是可以看到的。

KisThFir commented 2 months ago

@DustinWin 好的谢谢大佬👌🏻,你的教程帮了很多。 这套配置虽然可以正常观看 ipv6 直播源,但 ip 形式的 ipv6 源在 metacubexd 面板里面看不到相关活动连接,像被内核绕过了一样,ipv4 的正常。 反之如果是域名地址的源解析出来的 ipv6,就能看到活动连接。 这个问题怎么优化。

只搜 IPv6 前缀部分呢?话说老盯着面板干嘛~

也搜不到,完全无痕~

那就不清楚了。我目前在用 sing-box,这边是可以看到的。

但sing-box不支持负载均衡,好像作者也没计划。

DustinWin commented 2 months ago

@DustinWin 好的谢谢大佬👌🏻,你的教程帮了很多。 这套配置虽然可以正常观看 ipv6 直播源,但 ip 形式的 ipv6 源在 metacubexd 面板里面看不到相关活动连接,像被内核绕过了一样,ipv4 的正常。 反之如果是域名地址的源解析出来的 ipv6,就能看到活动连接。 这个问题怎么优化。

只搜 IPv6 前缀部分呢?话说老盯着面板干嘛~

也搜不到,完全无痕~

那就不清楚了。我目前在用 sing-box,这边是可以看到的。

但sing-box不支持负载均衡,好像作者也没计划。

那没办法了。