v2fly / v2ray-core

A platform for building proxies to bypass network restrictions.
https://v2fly.org
MIT License
28.3k stars 4.53k forks source link

dns.staticHosts parsing failed in jsonv5 format #2299

Closed manirover closed 1 year ago

manirover commented 1 year ago

What version of V2Ray are you using?

https://github.com/v2fly/v2ray-core/releases/tag/v5.2.1

What's your scenario of using V2Ray?

Setting up host mapping for dns servers.

What problems have you encountered?

The dns config failed to parse.

What's your expectation?

Passing the config parse.

Please attach your configuration here

Client configuration:

{
  "log": {
    "access": {
      "type": "File",
      "path": ".\\access.log",
      "level": "Warning"
    },
    "error": {
      "type": "File",
      "path": ".\\error.log",
      "level": "Warning"
    }
  },
  "dns": {
    "staticHosts": [
      {
        "type": "Full",
        "domain": "doh.opendns.com",
        "ip": "146.112.41.2"
      }    
    ]
  },
  "inbounds": [],
  "outbounds": [],
  "router": {}
}

If V2Ray cannot start up, please attach output from --test command

v2ray test -c configtest.json -format jsonv5
V2Ray 5.2.1 (V2Fly, a community-driven edition of V2Ray.) Custom (go1.19.4 windows/amd64)
A unified platform for anti-censorship.
Test failed: main/commands: failed to load config: [configtest.json] > infra/conf/v5cfg: unable to build config > infra/conf/v5cfg: failed to parse DNS config > common/registry: unable to parse json content > json: cannot unmarshal string into Go value of type []json.RawMessage
AkinoKaede commented 1 year ago

duplicate with #2107