v2ray/v2ray-core · error

unknown domain type

Error message

unknown domain type

What it means

Error "unknown domain type" thrown in v2ray/v2ray-core.

Source

Thrown at infra/conf/dns.go:55

		c.ExpectIPs = advanced.ExpectIPs
		return nil
	}

	return newError("failed to parse name server: ", string(data))
}

func toDomainMatchingType(t router.Domain_Type) dns.DomainMatchingType {
	switch t {
	case router.Domain_Domain:
		return dns.DomainMatchingType_Subdomain
	case router.Domain_Full:
		return dns.DomainMatchingType_Full
	case router.Domain_Plain:
		return dns.DomainMatchingType_Keyword
	case router.Domain_Regex:
		return dns.DomainMatchingType_Regex
	default:
		panic("unknown domain type")
	}
}

func (c *NameServerConfig) Build() (*dns.NameServer, error) {
	if c.Address == nil {
		return nil, newError("NameServer address is not specified.")
	}

	var domains []*dns.NameServer_PriorityDomain
	var originalRules []*dns.NameServer_OriginalRule

	for _, rule := range c.Domains {
		parsedDomain, err := parseDomainRule(rule)
		if err != nil {
			return nil, newError("invalid domain rule: ", rule).Base(err)
		}

		for _, pd := range parsedDomain {

View on GitHub (pinned to d80440f3d5)

Solutions

  1. Fix the domain rule syntax in the DNS/routing config: prefix with "domain:" (subdomain), "full:" (exact), "keyword:" (substring), or "regexp:" (regex) so the parsed domain type is one of the supported types.
  2. Remove or correct malformed domain entries in the name server's "domains" list that do not match any known rule type.
  3. If rules are generated programmatically, ensure the generator emits a recognized router.Domain_Type before it reaches toDomainMatchingType.

Example fix

"domains":["domain:example.com","full:www.example.com","keyword:cdn","regexp:^api\\..*\\.com$"]

When it happens

Trigger: Thrown at infra/conf/dns.go:55 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of v2ray/v2ray-core@d80440f3d5 (2026-08-15). Data as JSON: /api/errors/847700b34c9d6d93. Report an issue: GitHub.