mihomo icon indicating copy to clipboard operation
mihomo copied to clipboard

[Bug] ECH not working at all

Open dKenGuru opened this issue 1 year ago • 3 comments

Verify steps

  • [x] I have read the documentation and understand the meaning of all the configuration items I have written, rather than just piling up seemingly useful options or default values.
  • [x] I have carefully reviewed the documentation and have not resolved the issue.
  • [x] I have searched the Issue Tracker for the issue I want to raise and did not find it.
  • [x] I am a non-Chinese user.
  • [x] I have tested with the latest Alpha branch version, and the issue still persists.
  • [x] I have provided the server and client configuration files and processes that can reproduce the issue locally, rather than a sanitized complex client configuration file.
  • [x] I provided the simplest configuration that can be used to reproduce the errors in my report, rather than relying on remote servers or piling on a lot of unnecessary configurations for reproduction.
  • [x] I have provided complete logs, rather than just the parts I think are useful out of confidence in my own intelligence.
  • [x] I have directly reproduced the error using the Mihomo command-line program, rather than using other tools or scripts.

Operating System

Windows

System Version

26120.3291

Mihomo Version

1.19.2 and alpha e23f40a

Configuration File

mode: rule
ipv6: true
mixed-port: 20112
allow-lan: true
log-level: info
interface-name: ""
port: 0
socks-port: 0
secret: 
external-controller: 127.0.0.1:20113
external-ui: ""
keep-alive-interval: 30
find-process-mode: strict
external-controller-tls: ""
external-ui-name: ""
external-ui-url: ""
unified-delay: true
tcp-concurrent: true
authentication: []
skip-auth-prefixes:
  - 127.0.0.1/8
  - ::1/128
tls:
  certificate: ""
  private-key: ""
global-client-fingerprint: chrome
geodata-mode: false
geo-auto-update: false
geo-update-interval: 24
geodata-loader: standard
geosite-matcher: mph
geox-url:
  geoip: https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geoip.dat
  geosite: https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/geosite.dat
  mmdb: https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@release/country.mmdb
  asn: https://github.com/xishang0128/geoip/releases/download/latest/GeoLite2-ASN.mmdb
global-ua: chrome
profile:
  store-selected: true
  store-fake-ip: true
lan-allowed-ips:
  - 0.0.0.0/0
  - ::/0
lan-disallowed-ips: []
tun:
  enable: true
  stack: System
  auto-route: true
  route-address:
    - 0.0.0.0/1
    - 128.0.0.0/1
    - ::/1
    - 8000::/1
  auto-detect-interface: true
  dns-hijack:
    - any:53
  device: VPS
  mtu: 9000
  strict-route: true
  endpoint-independent-nat: false
dns:
  enable: true
  ipv6: true
  use-hosts: false
  use-system-hosts: true
  nameserver:
    - 1.1.1.1
  nameserver-policy: {}
  enhanced-mode: redir-host
  fake-ip-range: 198.18.0.1/16
  fake-ip-filter-mode: blacklist
  fake-ip-filter:
    - "*.lan"
    - "*.localdomain"
    - "*.example"
    - "*.invalid"
    - "*.localhost"
    - "*.test"
    - "*.local"
    - "*.home.arpa"
    - "*.msftconnecttest.com"
    - "*.msftncsi.com"
  prefer-h3: false
hosts: {}
proxy-providers:
  ID_jcn022k3:
    type: file
    path: ../subscribes/subscriptions.yaml
rule-providers:
  Re:filter w/ ECH:
    type: file
    behavior: domain
    path: ../rulesets/re-filter/ech.mrs
    format: mrs
  Re:filter w/o ECH:
    type: file
    behavior: domain
    path: ../rulesets/re-filter/noech.mrs
    format: mrs
  Re:filter IPs:
    type: file
    behavior: ipcidr
    path: ../rulesets/re-filter/ip-rule.mrs
    format: mrs
proxies: []
proxy-groups:
  - name: VPS
    type: select
    filter: ""
    exclude-filter: ""
    hidden: false
    icon: ""
    use:
      - ID_jcn022k3
    disable-udp: false
rules:
  - DOMAIN,cloudflare-ech.com,VPS
  - RULE-SET,Re:filter w/ ECH,DIRECT
  - RULE-SET,Re:filter w/o ECH,VPS
  - RULE-SET,Re:filter IPs,VPS,no-resolve

Description

I use ECH domain list for forward them to direct. This domains are blocked in our country. But they are working via Clouddflare Encrypted Client Hello. cloudflare-ech.com domain also blocked in our country. So you need: Put cloudflare-ech.com domain to Proxy. ECH domain list to Direct. (https://github.com/legiz-ru/mihomo-rule-sets/raw/main/re-filter/re-filter-ech.mrs)

This perfectly works with Sing-box core. But not with Mihomo. After core start, sites works couple of minutes and then stops respond. If stop core, close browser, start core and browser sites again working couple of minutes.

Reproduction Steps

Put cloudflare-ech.com domain to Proxy. ECH domain list to Direct. (https://github.com/legiz-ru/mihomo-rule-sets/raw/main/re-filter/re-filter-ech.mrs)

Try to open sites from list couple of minutes.

Logs


dKenGuru avatar Feb 24 '25 17:02 dKenGuru

Every request to domain from ECH list is need also parallel request to cloudflare-ech.com. But it is not is happening by unknown reason with Mihomo core.

dKenGuru avatar Feb 24 '25 17:02 dKenGuru

Add sniffing and now it's start working.

dKenGuru avatar Feb 25 '25 13:02 dKenGuru

@dKenGuru It also doesn't work for me. For me, I am using enhanced-mode: fake-ip

Could you please tell me how you have configured your proxy-providers?

Even though ech-opts.config has been configured, it still doesn't work properly. However, for Singbox, there is no issue at all.

proxies:
  - alterId: 0
    cipher: auto
    ech-opts:
      config: AEX+DQBBYgAgACCXbcPzp33+gtru6ag4USyb9gec248ic+BWROBuldicawAEAAEAAQASY2xvdWRmbGFyZS1lY2guY29tAAA=
      enable: true
    name: SG1-openai
    network: ws
    port: 443
    server: openai.com
    servername: xxx.eu.org
    skip-cert-verify: true
    tls: true
    type: vmess
    uuid: c5fdfb1f-xxxx-4b93-xxxx-8051aeb27bf0
    ws-opts:
      headers:
        Host: xxx.eu.org

wireshark cap

❯ tshark -i 9 -Y "tls.handshake.type == 1" -T fields -E header=y -e ip.dst -e ipv6.dst -e tcp.dstport -e tls.handshake.extensions_server_name -e tls.handshake.extension.type
104.16.148.11           443     xxx.eu.org       56026,0,23,65281,10,11,35,16,5,13,18,51,45,43,27,10794,21
172.64.147.159          443     xxx.eu.org       35466,0,23,65281,10,11,35,16,5,13,18,51,45,43,27,56026,21

eric-gitta-moore avatar Dec 10 '25 17:12 eric-gitta-moore