Freedom — Xray-core
Freedom is Xray's bypass outbound — it sends traffic to the real destination without any proxy protocol in the middle. Its own anti-DPI options — TCP/TLS fragmentation (fragment) and noise-packet injection (noises) — are deprecated: the same features are the fragment and noise masks of streamSettings.finalmask.
Outbound
settings for an outbound of "protocol": "freedom":
| Field | Type | Default | Allowed values | Description |
|---|---|---|---|---|
targetStrategy | string | asis | asis | useip | useipv4 | useipv6 | useipv4v6 | useipv6v4 | forceip | forceipv4 | forceipv6 | forceipv4v6 | forceipv6v4 | Deprecated — at startup a non-asis value is moved to streamSettings.sockopt.domainStrategy (same values) with a warning; set that instead. How the destination address is resolved before dial-out. asis passes through whatever the routing engine handed in; useip* resolves to IP only if needed; forceip* always resolves and replaces. The *v4v6 / *v6v4 suffixes control which family is tried first. |
domainStrategy | string | (inherits targetStrategy) | <same values> | Legacy alias for targetStrategy. Read only when targetStrategy is empty. Deprecated together with targetStrategy. |
redirect | string | (unset) | <host:port> | Override the destination of every dial. Useful for forwarding to a local service regardless of routing. |
userLevel | uint32 | 0 | <uint32> | Default policy level for connections passing through this outbound. |
fragment | *Fragment | (disabled) | Fragment | Deprecated — use a fragment mask in streamSettings.finalmask.tcp; setting it logs a warning at startup. Per-segment TCP fragmentation for evading length-based DPI. |
noise | *Noise | (unsupported) | (use finalmask noise) | Not supported — setting noise fails at startup. Use a noise mask in streamSettings.finalmask.udp. |
noises | []*Noise | (unset) | [Noise] | Deprecated — use a noise mask in streamSettings.finalmask.udp; setting it logs a warning at startup. Noise packets sent ahead of the first packet of each UDP flow to throw off pattern matching. |
proxyProtocol | uint32 | 0 | 0 | 1 | 2 | Prepend a PROXY-protocol header on outgoing connections. 0 disables; 1 / 2 set v1 (text) or v2 (binary). |
ipsBlocked | *StringList | (ignored) | (use finalRules) | Not supported — express IP blocks as finalRules; setting it only logs a warning and has no effect. |
finalRules | []*FreedomFinalRuleConfig | (unset) | [FreedomFinalRuleConfig] | Per-connection allow/block rules evaluated at dial time — a lightweight firewall on the outbound itself, matched by network / port / IP. Ignored (with a warning) when streamSettings.sockopt.dialerProxy is set. |
Source: infra/conf/freedom.go:20-31 · pinned at v26.11.9 (676eaf6)
fragment
| Field | Type | Default | Allowed values | Description |
|---|---|---|---|---|
packets | string | (all) | tlshello | <from-to> | | Which packets to fragment. tlshello fragments only the TLS ClientHello (subtler, useful for SNI obfuscation). A range like "1-3" fragments packets at that offset range. Empty fragments every packet — most aggressive. |
length | *Int32Range | (required) | <n> | "<min>-<max>" | Range of bytes per fragment. Min must be > 0. |
interval | *Int32Range | (required) | <n> | "<min>-<max>" | Range of milliseconds to delay between fragments. |
maxSplit | *Int32Range | (unbounded) | <n> | "<min>-<max>" | Range of total splits per packet. Optional cap. |
Source: infra/conf/freedom.go:33-38 · pinned at v26.11.9 (676eaf6)
noises[]
| Field | Type | Default | Allowed values | Description |
|---|---|---|---|---|
type | string | (required) | rand | str | hex | base64 | Packet payload form. rand generates random bytes whose length comes from packet (a range string). str/hex/base64 interpret packet literally. |
packet | string | (required) | <bytes or range> | Payload content. Format depends on type. |
delay | *Int32Range | (unset) | <n> | "<min>-<max>" | Range of milliseconds to wait after sending this noise packet. |
applyTo | string | ip | ip | all | ipv4 | ipv6 | Restrict noise injection to a single IP family. ip and all apply to both. |
Source: infra/conf/freedom.go:40-45 · pinned at v26.11.9 (676eaf6)
finalRules[]
A small allow/block firewall the freedom outbound applies as it dials out. Rules are evaluated in order; the first match decides. IP blocking belongs here — the ipsBlocked field is ignored.
| Field | Type | Default | Allowed values | Description |
|---|---|---|---|---|
action | string | (required) | allow | block | What to do with a matching connection. block blackholes it — its data is discarded and the connection held open for delay, then closed; allow lets it through — list allow rules first to carve exceptions out of a broader block. |
network | *NetworkList | (any) | tcp | udp | tcp,udp | Match only these networks. |
port | *PortList | (any) | <port / range list> | Match only these destination ports. |
ip | *StringList | (any) | <IP / CIDR / geoip:> | Match only these destination IPs. Accepts geoip: categories. |
delay | *Int32Range | 30-90 | <seconds> | "<min>-<max>" | block rules only — on an allow rule it fails at startup. Seconds a blocked connection is blackholed before it is closed; a range picks a random value, and 0 closes it at once. |
logLevel | string | info | debug | info | warning | error | none | block rules only — on an allow rule it fails at startup. Severity of the log lines written when this rule blocks a connection and when it closes it; none silences them. Unknown values fail at startup. |
blockDelay | *Int32Range | (deprecated) | (use delay) | Deprecated — use delay. At startup a warning is logged and the value is copied into delay, replacing any delay on the same rule. |
Source: infra/conf/freedom.go:47-55 · pinned at v26.11.9 (676eaf6)
Examples
Plain freedom outbound (passthrough):
{
"outbounds": [
{ "tag": "direct", "protocol": "freedom", "settings": {} }
]
}Force IPv4-then-IPv6 resolution:
{
"outbounds": [
{
"tag": "direct-v4",
"protocol": "freedom",
"settings": {},
"streamSettings": { "sockopt": { "domainStrategy": "forceipv4v6" } }
}
]
}TLS-hello fragmentation (good first try for SNI obfuscation) — a fragment mask in streamSettings.finalmask.tcp replaces the deprecated settings.fragment (the pause between fragments is called delay there):
{
"outbounds": [
{
"tag": "frag",
"protocol": "freedom",
"settings": {},
"streamSettings": {
"finalmask": {
"tcp": [
{
"type": "fragment",
"settings": {
"packets": "tlshello",
"length": "10-20",
"delay": "10-20"
}
}
]
}
}
}
]
}Noise injection — a noise mask in streamSettings.finalmask.udp replaces the deprecated settings.noises (here: 4 random bytes, then a 5–10 ms pause, before the first packet to each UDP destination):
{
"outbounds": [
{
"tag": "noisy",
"protocol": "freedom",
"settings": {},
"streamSettings": {
"finalmask": {
"udp": [
{
"type": "noise",
"settings": {
"noise": [
{ "rand": 4, "delay": "5-10" }
]
}
}
]
}
}
}
]
}Blackhole QUIC (UDP/443) without logging it, and stall connections to private ranges for 2–5 minutes to slow down probing, logging them as warnings:
{
"outbounds": [
{
"tag": "direct",
"protocol": "freedom",
"settings": {
"finalRules": [
{ "action": "block", "network": "udp", "port": "443", "logLevel": "none" },
{ "action": "block", "ip": ["geoip:private"], "delay": "120-300", "logLevel": "warning" }
]
}
}
]
}Forward everything to a local service (testing helper):
{
"outbounds": [
{
"tag": "redir",
"protocol": "freedom",
"settings": { "redirect": "127.0.0.1:8080" }
}
]
}Notes
targetStrategy/domainStrategyin freedomsettingsare deprecated. At startup Xray moves a non-asisvalue intostreamSettings.sockopt.domainStrategyand logs a warning; an outbound-leveltargetStrategyon a freedom outbound is migrated the same way (infra/conf/xray.go:410-433). The migrated value overwrites asockopt.domainStrategyyou set yourself, so configure only one of them.domainStrategyis still read only as a fallback whentargetStrategyis empty (infra/conf/freedom.go:65-68).- With
finalRulesand a domain destination, freedom first resolves the domain (viasockopt.domainStrategy, or the system resolver when that isAsIs) to checkblockrules, then re-checks the address it actually connected to. - When
streamSettings.sockopt.dialerProxyis set, freedom is not the final hop:finalRulesare ignored (a warning is logged) and the domain is not pre-resolved. - Freedom rejects
streamSettings.sockopt.addressPortStrategyat startup. - Unknown strategy strings produce a startup error rather than a silent fallback (
infra/conf/freedom.go:92-93). noise(singular) is not supported: setting it fails at startup with a message pointing tonoises = [ { ... } ](infra/conf/freedom.go:149-151), andnoisesitself is deprecated in favour of anoisemask instreamSettings.finalmask.udp.ipsBlockedis not supported — express it as a{ "action": "block", "ip": [...] }rule infinalRules; the field itself only logs a warning and is otherwise ignored.finalRulesactions areallow/blockonly (unknown actions error at startup).ipacceptsgeoip:categories.delayandlogLevelare valid only onblockrules — on anallowrule they fail at startup (infra/conf/freedom.go:290-295).- Default policy. When no
finalRulesentry matches, freedom falls back to a built-inblockrule picked by the inbound the connection came through: traffic fromvless,vmess,trojan,shadowsocks,hysteria,wireguardandmasqueinbounds is blocked when it targets a private / LAN address, and traffic arriving through a VLESS reverse tunnel is blocked entirely (both logged atwarning). A matchingallowrule wins, e.g.{ "action": "allow", "ip": ["geoip:private"] }. The default does not apply whensockopt.dialerProxyis set. fragmentandnoisesstill work but log a deprecation warning at startup. Their replacements are afragmentmask instreamSettings.finalmask.tcp(the pause between fragments is calleddelaythere) and anoisemask instreamSettings.finalmask.udp(see the examples above).fragment.packets: "tlshello"is the recommended starting point — fragmenting only the TLS ClientHello breaks SNI-based DPI but leaves the rest of the connection untouched (the byte-overhead is one-time).fragment.length(with a non-zero minimum) andfragment.intervalare required whenfragmentis present (infra/conf/freedom.go:122-139). ThemaxSplitrange is optional. Ranges are written as a number or a"min-max"string —{ "from": …, "to": … }objects are rejected.proxyProtocoloutside1..2is silently ignored — only those two values produce header output (infra/conf/freedom.go:186-188).
Cross-core notes
- sing-box calls this Direct and the outbound has almost no options of its own — it has no destination-override fields; use route actions for that behavior. See Direct — sing-box.
- mihomo has a similarly minimal Direct type; the built-in
DIRECTproxy is implicit in every config. See Direct — mihomo.
Source: infra/conf/freedom.go:20-55 · v26.11.9 (676eaf6)
