MetaCubeX/mihomo

[Bug] Panic if external-controller set as localhost in 1.18.10

Opened this issue · 0 comments

Verify steps

  • 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.
  • I have carefully reviewed the documentation and have not resolved the issue.
  • I have searched the Issue Tracker for the issue I want to raise and did not find it.
  • I am a non-Chinese user.
  • I have tested with the latest Alpha branch version, and the issue still persists.
  • 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.
  • 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.
  • I have provided complete logs, rather than just the parts I think are useful out of confidence in my own intelligence.
  • I have directly reproduced the error using the Mihomo command-line program, rather than using other tools or scripts.

Operating System

Windows

System Version

24h2

Mihomo Version

Mihomo Meta alpha-de19f92 windows amd64 with go1.23.2 Thu Nov 14 02:10:44 UTC 2024
Use tags: with_gvisor

Configuration File

external-controller: localhost:9090
proxy-providers:
  1:
    url: ""
    type: http
    interval: 86400
    health-check: {enable: true,url: "https://www.gstatic.com/generate_204",interval: 300}
    override:
      additional-prefix: "[1]" 

proxies: 
  - name: "直连"
    type: direct
    udp: true

geodata-mode: true
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"
  asn: "https://mirror.ghproxy.com/https://github.com/xishang0128/geoip/releases/download/latest/GeoLite2-ASN.mmdb"

dns:
  enable: true
  ipv6: true
  respect-rules: true
  enhanced-mode: fake-ip
  fake-ip-filter:
    - "*"
    - "+.lan"
    - "+.local"
    - "+.market.xiaomi.com"
  nameserver:
    - https://223.5.5.5/dns-query
  proxy-server-nameserver:
    - https://223.5.5.5/dns-query
  nameserver-policy:
    "geosite:cn,private":
      - https://223.5.5.5/dns-query
    "geosite:geolocation-!cn":
      - "https://dns.cloudflare.com/dns-query"
      - "https://dns.google/dns-query"

proxy-groups:

  - name: 默认
    type: select
    proxies: [自动选择]

  - name: 国内
    type: select
    proxies:  [直连]

  - name: 其他
    type: select
    proxies:  [默认]

  - name: 自动选择
    type: url-test
    include-all: true
    tolerance: 10

rules:
  - GEOIP,CN,国内
  - MATCH,其他

Description

Panic when external-controller set as localhost, eg
external-controller: localhost:9090

Should we also fix this or guide user to use 127.0.0.1/::1

Reproduction Steps

Update to 1.18.10 from 1.18.9

Logs

panic: should never be called

goroutine 52 [running]:
main.main.func1({0xc000727218?, 0x76f565?}, {0x30?, 0x156cd60?}, {0xc00015a101?, 0xc000727280?})
        github.com/metacubex/mihomo/main.go:63 +0x25
net.(*Resolver).dial(0xc000112510?, {0x17fadc0?, 0xc00015a150?}, {0x1614633?, 0x2193aa0?}, {0xc00217c100?, 0x0?})
        net/lookup.go:699 +0x63
net.(*Resolver).exchange(_, {_, _}, {_, _}, {{{0x6c, 0x6f, 0x63, 0x61, 0x6c, ...}, ...}, ...}, ...)
        net/dnsclient_unix.go:184 +0x34a
net.(*Resolver).tryOneName(0x2192260, {0x17fad50, 0xc000090050}, 0xc00064f47d?, {0xc0016a0060, 0xa}, 0x1c)
        net/dnsclient_unix.go:305 +0x44b
net.(*Resolver).goLookupIPCNAMEOrder.func3.1(0x7547?)
        net/dnsclient_unix.go:680 +0x85
created by net.(*Resolver).goLookupIPCNAMEOrder.func3 in goroutine 50
        net/dnsclient_unix.go:679 +0x13f
panic: should never be called

goroutine 51 [running]:
main.main.func1({0xc0012b5218?, 0x76f565?}, {0x30?, 0x156cd60?}, {0xc0001d3a01?, 0xc0012b5280?})
        github.com/metacubex/mihomo/main.go:63 +0x25
net.(*Resolver).dial(0xc00122a250?, {0x17fadc0?, 0xc0001d3ab0?}, {0x1614633?, 0x2193aa0?}, {0xc00217c100?, 0x0?})
        net/lookup.go:699 +0x63
net.(*Resolver).exchange(_, {_, _}, {_, _}, {{{0x6c, 0x6f, 0x63, 0x61, 0x6c, ...}, ...}, ...}, ...)
        net/dnsclient_unix.go:184 +0x34a
net.(*Resolver).tryOneName(0x2192260, {0x17fad50, 0xc000090050}, 0xc00012b700?, {0xc0016a0060, 0xa}, 0x1)
        net/dnsclient_unix.go:305 +0x44b
net.(*Resolver).goLookupIPCNAMEOrder.func3.1(0x71d5?)
        net/dnsclient_unix.go:680 +0x85
created by net.(*Resolver).goLookupIPCNAMEOrder.func3 in goroutine 50
        net/dnsclient_unix.go:679 +0x13f