配置
vx-core 服务器配置参考(ServerConfig)
vx-core 读取单个服务器配置文件。根消息为 protos/proto/vx/server.proto 中的 ServerConfig。
配置格式
配置为 protobuf 消息,可序列化为:
- 二进制 protobuf — 紧凑;部分内部路径使用
- ProtoJSON — 人类可读的 JSON;适合手工编辑
协议与传输的类型化设置使用 google.protobuf.Any。在 JSON 中,将 @type 设为消息的类型 URL:
{
"@type": "type.googleapis.com/vx.proxy.trojan.TrojanServerConfig",
"users": [{ "secret": "your-password" }]
}JSON 字段名使用 camelCase(例如 matchAll、outboundTag、multiInbounds)。
ServerConfig 概览
最小服务器示例:
{
"inbounds": [
{
"tag": "trojan",
"ports": [443],
"protocol": {
"@type": "type.googleapis.com/vx.proxy.trojan.TrojanServerConfig"
}
}
],
"router": {
"rules": [{ "matchAll": true, "outboundTag": "direct" }]
},
"outbounds": [
{
"tag": "direct",
"protocol": {
"@type": "type.googleapis.com/vx.proxy.freedom.FreedomConfig"
}
}
]
}章节
入站
ProxyInboundConfig 与 MultiProxyInboundConfig
出站
OutboundHandlerConfig 与 protocol Any
路由
RuleConfig、条件、选择器、回退
DNS
服务器、解析器、劫持、Fake DNS
Geo
规则使用的域名/IP/应用集合
策略
超时与缓冲区大小
日志
LoggerConfig
用户
UserConfig
调度器
嗅探与会话统计
拨号器工厂
拨号超时与网卡绑定
代理协议
VMess、VLESS、Trojan、Shadowsocks 等
传输
TCP、WebSocket、gRPC、KCP、xhttp、socket
安全
TLS 与 REALITY
CLI
vx run --config config.json`--config`default config.json
配置文件路径
通过安装脚本安装时,默认路径为 /usr/local/etc/vx/config.json。
Proto 源文件
根protos/proto/vx/server.proto
入站protos/proto/vx/inbound/inbound.proto
出站protos/proto/vx/outbound/outbound.proto
路由protos/proto/vx/router/router.proto
DNSprotos/proto/vx/dns/dns.proto
Geoprotos/proto/vx/geo/geo.proto
策略protos/proto/vx/policy.proto
日志protos/proto/vx/log/logger.proto
用户protos/proto/vx/user/user.proto
调度器protos/proto/vx/dispatcher/dispatcher.proto
拨号器工厂protos/proto/vx/dialerfactory/dialerfactory.proto
代理协议protos/proto/vx/proxy/*/ — 文档
传输protos/proto/vx/transport/ — 文档
安全(TLS/REALITY)protos/proto/vx/transport/security/ — 文档