XTLS/Xray-core · error

substr in dotless rule should not contain a dot

Error message

substr in dotless rule should not contain a dot

What it means

The 'dotless:' domain rule builds a regex '^[^.]*SUBSTR[^.]*$' matching single-label hostnames containing SUBSTR. Because the regex excludes dots, a SUBSTR containing '.' can never match and is rejected immediately as a configuration contradiction.

Source

Thrown at common/geodata/rule_parser.go:254

		domain.Value = rule[7:]

	case strings.HasPrefix(rule, "full:"):
		domain.Type = Domain_Full
		domain.Value = rule[5:]

	case strings.HasPrefix(rule, "keyword:"):
		domain.Type = Domain_Substr
		domain.Value = rule[8:]

	case strings.HasPrefix(rule, "dotless:"):
		domain.Type = Domain_Regex
		switch substr := rule[8:]; {
		case substr == "":
			domain.Value = "^[^.]*$"
		case !strings.Contains(substr, "."):
			domain.Value = "^[^.]*" + substr + "[^.]*$"
		default:
			return nil, errors.New("substr in dotless rule should not contain a dot")
		}

	default:
		domain.Type = defaultType
		domain.Value = rule
	}

	return &DomainRule_Custom{
		Custom: domain,
	}, nil
}

View on GitHub (pinned to 7d214f8b09)

Solutions

  1. For suffix/domain matching use "domain:example.com"; for exact host use "full:example.com".
  2. Keep dotless: values dot-free, e.g. "dotless:internal" to match hostnames like 'db-internal'.

Example fix

// before
"domain": ["dotless:example.com"]

// after
"domain": ["domain:example.com"]
Defensive patterns

Strategy: validation

Validate before calling

if strings.HasPrefix(r, "dotless:") && strings.Contains(r[8:], ".") {
    return fmt.Errorf("%q: dotless value must not contain a dot; use domain: instead", r)
}

Prevention

When it happens

Trigger: Domain rule "dotless:example.com" (or any value containing a dot) — invalid by construction.

Common situations: Misunderstanding dotless matching: developers try to use dotless: for suffix matching instead of 'domain:'.

Related errors


AI-assisted analysis of XTLS/Xray-core@7d214f8b09 (2026-08-15). Data as JSON: /api/errors/ca0a2b416bf5e8cf. Report an issue: GitHub.