Files
pyxray/docs/config.md
T
2026-05-27 09:55:37 +08:00

54 lines
2.7 KiB
Markdown

# pyxray 配置总览
配置来源分两类:
| 文件 | 数据结构 | 入口 | 作用 |
| --- | --- | --- | --- |
| `settings.toml` | `XrayConfigSettings` | 配置页 | 生成 `config.json`、透明代理脚本和 `tinytun.yaml`。 |
| `download.toml` | `XrayAssetSettings` | 下载页 | 保存 Xray 资源下载参数。 |
UI 中有些字段隐藏但仍存在于 `settings.toml`。下表的“UI”列含义:
| UI | 含义 |
| --- | --- |
| 显示 | Web 配置页可直接修改。 |
| 隐藏 | Web 不显示,但保存时会写入默认值或保留已有值。 |
| 下载页 | 不属于配置页,在下载页显示。 |
## 分类
| 分类 | 文档 | 主要影响 |
| --- | --- | --- |
| 核心 | [config/core.md](config/core.md) | Xray 日志、Mux、TCP Fast Open。 |
| 入站 | [config/inbounds.md](config/inbounds.md) | SOCKS/HTTP/rule/API/自定义入站。 |
| 路由 | [config/routing.md](config/routing.md) | rule 入站和透明代理流量的分流策略。 |
| DNS | [config/dns.md](config/dns.md) | Xray DNS 模块、本地 DNS 入站、DNS 服务器路由。 |
| 透明代理 | [config/transparent.md](config/transparent.md) | transparent inbound、iptables/nft、resolv、TinyTun。 |
| 出站和自动更新 | [config/outbounds-auto-update.md](config/outbounds-auto-update.md) | 出站组预留字段、自动更新预留字段。 |
| 资源下载 | [config/assets.md](config/assets.md) | `xray``geoip.dat``geosite.dat` 下载设置。 |
## 配置生成结果
| 输出 | 触发 | 说明 |
| --- | --- | --- |
| `config.json` | 生成配置/启动 Xray | Xray 主配置。 |
| `transparent/ip-forward-apply.sh` | 生成配置/启动 Xray | 写 `/proc/sys/net/...`。 |
| `transparent/resolv-hijack-setup.sh` | 生成配置/启动 Xray | redirect DNS 劫持时改 `/etc/resolv.conf`。 |
| `transparent/resolv-hijack-cleanup.sh` | 停止/回滚 | 恢复 DNS。 |
| `transparent/transparent-iptables-*.sh` | 生成配置/启动/停止 | iptables 规则安装和清理。 |
| `transparent/transparent-nft-*.sh` | 生成配置/启动/停止 | nftables 规则安装和清理。 |
| `transparent/v2raya.nft` | nft 模式 | nftables 表内容。 |
| `transparent/tinytun.yaml` | `transparent.type = tun` | TinyTun 配置。 |
## 关键默认值
| 设置 | 默认值 | 说明 |
| --- | --- | --- |
| `core.log_level` | `info` | 日常日志等级。 |
| `inbounds.rule_http_port` | `20172` | 规则 HTTP 代理入口。 |
| `routing.mode` | `whitelist` | 国内/私有直连,其它代理。 |
| `transparent.mode` | `close` | 默认不启用透明代理。 |
| `transparent.type` | `redirect` | 推荐先用 redirect。 |
| `dns.query_strategy` | `UseIPv4` | 默认优先 IPv4。 |
| `dns.local_dns_listen` | `true` | redirect 透明代理下生成本地 DNS 入站。 |