{"record":{"id":"8212036ae55d4db5","repo":"XTLS/Xray-core","slug":"unsupported-domain-strategy","errorCode":null,"errorMessage":"unsupported domain strategy: {}","messagePattern":"unsupported domain strategy: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"infra/conf/freedom.go","lineNumber":90,"sourceCode":"\t\tconfig.DomainStrategy = internet.DomainStrategy_USE_IP4\n\tcase \"useipv6\":\n\t\tconfig.DomainStrategy = internet.DomainStrategy_USE_IP6\n\tcase \"useipv4v6\":\n\t\tconfig.DomainStrategy = internet.DomainStrategy_USE_IP46\n\tcase \"useipv6v4\":\n\t\tconfig.DomainStrategy = internet.DomainStrategy_USE_IP64\n\tcase \"forceip\":\n\t\tconfig.DomainStrategy = internet.DomainStrategy_FORCE_IP\n\tcase \"forceipv4\":\n\t\tconfig.DomainStrategy = internet.DomainStrategy_FORCE_IP4\n\tcase \"forceipv6\":\n\t\tconfig.DomainStrategy = internet.DomainStrategy_FORCE_IP6\n\tcase \"forceipv4v6\":\n\t\tconfig.DomainStrategy = internet.DomainStrategy_FORCE_IP46\n\tcase \"forceipv6v4\":\n\t\tconfig.DomainStrategy = internet.DomainStrategy_FORCE_IP64\n\tdefault:\n\t\treturn nil, errors.New(\"unsupported domain strategy: \", targetStrategy)\n\t}\n\n\tif c.Fragment != nil {\n\t\tconfig.Fragment = new(freedom.Fragment)\n\n\t\tswitch strings.ToLower(c.Fragment.Packets) {\n\t\tcase \"tlshello\":\n\t\t\t// TLS Hello Fragmentation (into multiple handshake messages)\n\t\t\tconfig.Fragment.PacketsFrom = 0\n\t\t\tconfig.Fragment.PacketsTo = 1\n\t\tcase \"\":\n\t\t\t// TCP Segmentation (all packets)\n\t\t\tconfig.Fragment.PacketsFrom = 0\n\t\t\tconfig.Fragment.PacketsTo = 0\n\t\tdefault:\n\t\t\t// TCP Segmentation (range)\n\t\t\tfrom, to, err := ParseRangeString(c.Fragment.Packets)\n\t\t\tif err != nil {","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/infra/conf/freedom.go#L72-L108","documentation":"Thrown by freedom outbound Build() when the (effective) domainStrategy string is not one of the supported keywords. After resolving targetStrategy (from the outbound's setting or the global one), the switch accepts asis/useip/useipv4/useipv6/useip4/useip6/forceip/forceipv4/forceipv6/forceipv4v6/forceipv6v4 (case-insensitive); anything else hits the default branch.","triggerScenarios":"\"domainStrategy\": \"use_ip\" (underscore instead of concatenation), \"ForceIP\", \"prefer_ipv4\", or any non-listed synonym in a freedom outbound or the global settings; also triggered when the strategy falls back to the global value and that global value is invalid.","commonSituations":"Copy-pasting strategy names from sing-box or Clash configs (they use different spellings like 'ipv4_only'); upgrading from configs written against older docs; assuming underscores are allowed.","solutions":["Use one of the exact tokens: \"AsIs\", \"UseIP\", \"UseIPv4\", \"UseIPv6\", \"UseIP4\", \"UseIP6\", \"ForceIP\", \"ForceIPv4\", \"ForceIPv6\", \"ForceIPv4v6\", \"ForceIPv6v4\" (case-insensitive).","If translating from sing-box: ipv4_only -> UseIPv4, ipv6_only -> UseIPv6, prefer_ipv4 -> UseIPv4/UseIP4.","Check the global \"domainStrategy\" too — an invalid global value surfaces here when the outbound does not override it."],"exampleFix":"// before\n\"domainStrategy\": \"use_ipv4\"\n\n// after\n\"domainStrategy\": \"UseIPv4\"","handlingStrategy":"validation","validationCode":"var validStrategies = map[string]bool{\n    \"asis\": true, \"useip\": true, \"useipv4\": true, \"useipv6\": true,\n    \"useip4\": true, \"useip6\": true, \"forceip\": true, \"forceipv4\": true,\n    \"forceipv6\": true, \"forceipv4v6\": true, \"forceipv6v4\": true,\n}\nif !validStrategies[strings.ToLower(strategy)] {\n    return fmt.Errorf(\"unsupported domain strategy %q\", strategy)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use concatenated camel-case tokens (UseIPv4), never underscores.","When porting from sing-box/Clash, map their strategy names explicitly.","Check both outbound-level and global domainStrategy."],"tags":["go","xray","freedom","outbound","config","validation"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}