本页汇总 OneXray 当前的持久化与运行时语义。
配置类型与 Tag#
| 标识 | 含义 |
|---|---|
CoreConfigType.outbound |
本地或订阅 Outbound。 |
CoreConfigType.profile |
Dart 中的 Xray 配置;持久化 wire value 仍为 "setting"。 |
CoreConfigType.full |
Home Local 下的 Full Config。 |
CoreConfigType.raw |
Home Local 下的 Raw Json。 |
Simple |
内置 Profile,id 为 -1。 |
proxy |
运行时最终代理出口。 |
chainProxy |
启用最终出口时 Home 节点的运行时中转 tag。 |
direct |
Freedom 直连出口。 |
tunIn |
运行时 TUN inbound。 |
pingIn |
运行时 HTTP ping inbound。 |
Home 路由模式#
| 模式 | 是否要求节点 | 转换 |
|---|---|---|
rule |
是 | 保留合成后的 DNS、routing 和 outbound 结构。 |
global |
是 | 删除 DNS/routing;保留 proxy 和递归依赖的 dialerProxy outbounds。 |
direct |
否 | 删除 DNS/routing;只保留 direct 并清除其 dialerProxy。 |
连接中切换会重启 Core。
导入分类#
| 输入 | 结果 |
|---|---|
去除首尾空白后以 https:// 开头 |
每个有效 HTTPS 行成为一个订阅导入项。 |
| 其他受支持文本 | libXray 返回 Outbound model。 |
订阅 fragment 用作名称,但不会保存到 URL。支持文件扩展名:txt、json、yaml、yml、png、jpg、jpeg。通用导入不创建 Raw Json、Full Config、Xray 配置或 GeoData。
简易配置默认值#
| 字段 | 默认值 |
|---|---|
routing.domainStrategy |
IpIfNonMatch |
routing.directSet |
CN |
routing.appleDirect |
true |
routing.localDirect |
true |
routing.enableIPRule |
true |
routing.localDns |
true |
routing.blockAds |
false |
enableLog |
false |
fakeDns |
false |
finalOutboundId |
null |
| 默认 DNS | tcp://<TUN IPv4 DNS>,tag 为 defaultDns,通过 proxy |
地区本地 DNS 仍为:CN 223.5.5.5、IR 5.200.200.200、RU 9.9.9.9、Other 8.8.8.8。仅在启用本地 DNS 时查询匹配的直连域名集合。
广告屏蔽会增加指向 block 的内置广告域名规则。
DNS 与 FakeDNS#
运行时策略由 TUN 设置派生:
| IPv6 | 策略 | FakeDNS 地址池 |
|---|---|---|
| 开启 | UseIP |
IPv4 198.18.0.0/15 和 IPv6 fc00::/18 |
| 关闭 | UseIPv4 |
仅 IPv4 |
新建自定义 Profile 和 Full Config 时,DNS Server 默认使用当前 TUN IPv4 DNS。Full Config 管理 outbounds、routing 和 dns,不管理 FakeDNS。
运行时合成#
| 保存类型 | 规则模式最终配置 |
|---|---|
| Outbound | 当前 Profile 加 Home Outbound proxy;可通过 chainProxy 应用最终出口反转。 |
| Full Config | Profile 基础加 Full Config 的 outbounds/routing/dns;Profile 的 FakeDNS/inbounds/log/metrics 保留。 |
| Raw Json | Raw 主体加 App 重写的 inbounds、DNS 策略、日志、metrics、env 和路由字段。 |
Release 运行时 inbounds 为 tunIn 与 pingIn。用户 Raw Json inbounds 在校验、Real Ping、保存和启动时都会被删除。
运行时所有权字段#
- 随机
pingIn与 metrics 端口 env.xray.location.asset与env.xray.location.cert- 移动端
env.xray.tun.fd - Windows/Linux TUN gateway、DNS、路由和出站网卡
- Access/Error 日志路径,或 macOS System Extension 日志禁用
- 可选 policy/stats/metrics
Routing Rule 字段#
自定义规则支持:
domain, ip, port, sourcePort, localPort, network, sourceIP, localIP,
inboundTag, protocol, attrs, process, outboundTag, ruleTagprocess 仅在 Windows 和 Linux 写出。
Raw Json 校验#
Raw Json 必须是包含非空 name 的 JSON object。手动校验会将 inbounds 替换为 pingIn、移除 metrics、应用运行时 env,并调用内置 Xray 配置测试。普通 Outbound/分享导入不执行该手动保存测试。
Backup v3#
manifest.json
core_configs.json
subscriptions.json
geo_data.json
dat/Manifest 保存版本 3 和创建时间。本地配置与 GeoData 从归档恢复;订阅节点通过恢复的源 URL 重新下载。