{"record":{"id":"2bf61d58082115ab","repo":"XTLS/Xray-core","slug":"unsupported-domain-strategy-2bf61d","errorCode":null,"errorMessage":"unsupported domain strategy: ","messagePattern":"unsupported domain strategy: ","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"infra/conf/transport_sockopt.go","lineNumber":120,"sourceCode":"\t\tdStrategy = internet.DomainStrategy_USE_IP4\n\tcase \"useipv6\":\n\t\tdStrategy = internet.DomainStrategy_USE_IP6\n\tcase \"useipv4v6\":\n\t\tdStrategy = internet.DomainStrategy_USE_IP46\n\tcase \"useipv6v4\":\n\t\tdStrategy = internet.DomainStrategy_USE_IP64\n\tcase \"forceip\":\n\t\tdStrategy = internet.DomainStrategy_FORCE_IP\n\tcase \"forceipv4\":\n\t\tdStrategy = internet.DomainStrategy_FORCE_IP4\n\tcase \"forceipv6\":\n\t\tdStrategy = internet.DomainStrategy_FORCE_IP6\n\tcase \"forceipv4v6\":\n\t\tdStrategy = internet.DomainStrategy_FORCE_IP46\n\tcase \"forceipv6v4\":\n\t\tdStrategy = internet.DomainStrategy_FORCE_IP64\n\tdefault:\n\t\treturn nil, errors.New(\"unsupported domain strategy: \", c.DomainStrategy)\n\t}\n\n\tvar customSockopts []*internet.CustomSockopt\n\n\tfor _, copt := range c.CustomSockopt {\n\t\tcustomSockopt := &internet.CustomSockopt{\n\t\t\tSystem:  copt.Syetem,\n\t\t\tNetwork: copt.Network,\n\t\t\tLevel:   copt.Level,\n\t\t\tOpt:     copt.Opt,\n\t\t\tValue:   copt.Value,\n\t\t\tType:    copt.Type,\n\t\t}\n\t\tcustomSockopts = append(customSockopts, customSockopt)\n\t}\n\n\taddressPortStrategy := internet.AddressPortStrategy_None\n\tswitch strings.ToLower(c.AddressPortStrategy) {","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/infra/conf/transport_sockopt.go#L102-L138","documentation":"Thrown while building SocketConfig when the 'domainStrategy' string inside 'sockopt' does not match any supported value. The switch accepts only AsIs, UseIP, UseIPv4, UseIPv6, UseIP46, UseIP64, ForceIP, ForceIPv4, ForceIPv6, ForceIPv4v6, ForceIPv6v4 (case-sensitive as written in the source); anything else hits the default branch. Note this is the sockopt-level strategy, distinct from the top-level outbound 'domainStrategy'.","triggerScenarios":"Setting \"sockopt\": { \"domainStrategy\": \"use-ip\" } (kebab-case), \"Use_IP\", \"Asis\", or a typo like \"UzeIP\" in streamSettings of any inbound/outbound.","commonSituations":"Mixing up casing conventions with other Xray fields that are case-insensitive, porting a V2Ray config that used different spellings, or assuming kebab-case like the DNS strategy names.","solutions":["Use one of the exact camelCase values: \"AsIs\", \"UseIP\", \"UseIPv4\", \"UseIPv6\", \"UseIP46\", \"UseIP64\", \"ForceIP\", \"ForceIPv4\", \"ForceIPv6\", \"ForceIPv4v6\", \"ForceIPv6v4\"","Check for typos and stray whitespace in the value","Remove the key to fall back to the default behavior if sockopt-level domain strategy is not required"],"exampleFix":"// before\n\"sockopt\": { \"domainStrategy\": \"use-ipv4\" }\n// after\n\"sockopt\": { \"domainStrategy\": \"UseIPv4\" }","handlingStrategy":"validation","validationCode":"var sockoptDomainStrategies = map[string]bool{\n    \"AsIs\": true, \"UseIP\": true, \"UseIPv4\": true, \"UseIPv6\": true,\n    \"UseIP46\": true, \"UseIP64\": true, \"ForceIP\": true, \"ForceIPv4\": true,\n    \"ForceIPv6\": true, \"ForceIPv4v6\": true, \"ForceIPv6v4\": true,\n}\nif s, ok := sockopt[\"domainStrategy\"]; ok {\n    if !sockoptDomainStrategies[s.(string)] {\n        return fmt.Errorf(\"invalid sockopt.domainStrategy: %q\", s)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep an allow-list of strategy literals in config tooling and validate before writing","Remember sockopt.domainStrategy is case-sensitive camelCase, unlike some other Xray enums","Run `xray run -test` in CI for every config change"],"tags":["config","dns","domain-strategy","socket"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}