访问密钥配置
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Outline 使用基于 YAML 的配置来定义 VPN 参数并处理 TCP/UDP 流量。该配置支持多个级别的可组合性,可实现灵活且可扩展的设置。
顶级配置指定了 TunnelConfig。
示例
典型的 Shadowsocks 配置如下所示:
transport:
$type: tcpudp
tcp:
$type: shadowsocks
endpoint: ss.example.com:80
cipher: chacha20-ietf-poly1305
secret: SECRET
prefix: "POST " # HTTP request
udp:
$type: shadowsocks
endpoint: ss.example.com:53
cipher: chacha20-ietf-poly1305
secret: SECRET
prefix: "\u0097\u00a7\u0001\u0000\u0000\u0001\u0000\u0000\u0000\u0000\u0000\u0000" # DNS query
请注意,我们现在可以让 TCP 和 UDP 在不同的端口或端点上运行,并使用不同的前缀。
您可以使用 YAML 锚标记和 <<
合并键来避免重复:
transport:
$type: tcpudp
tcp:
<<: &shared
$type: shadowsocks
endpoint: ss.example.com:4321
cipher: chacha20-ietf-poly1305
secret: SECRET
prefix: "POST "
udp: *shared
现在可以组合策略并执行多跳:
transport:
$type: tcpudp
tcp:
$type: shadowsocks
endpoint:
$type: dial
address: exit.example.com:4321
dialer:
$type: shadowsocks
address: entry.example.com:4321
cipher: chacha20-ietf-poly1305
secret: ENTRY_SECRET
cipher: chacha20-ietf-poly1305
secret: EXIT_SECRET
udp: *shared
如果 Shadowsocks 等“隐形”协议被屏蔽,您可以使用 Shadowsocks-over-WebSocket。如需了解如何部署,请参阅服务器示例配置。客户端配置如下所示:
transport:
$type: tcpudp
tcp:
$type: shadowsocks
endpoint:
$type: websocket
url: wss://legendary-faster-packs-und.trycloudflare.com/SECRET_PATH/tcp
cipher: chacha20-ietf-poly1305
secret: SS_SECRET
udp:
$type: shadowsocks
endpoint:
$type: websocket
url: wss://legendary-faster-packs-und.trycloudflare.com/SECRET_PATH/udp
cipher: chacha20-ietf-poly1305
secret: SS_SECRET
请注意,WebSocket 端点反过来也可以采用端点,利用端点可绕过基于 DNS 的屏蔽:
transport:
$type: tcpudp
tcp:
$type: shadowsocks
endpoint:
$type: websocket
url: wss://legendary-faster-packs-und.trycloudflare.com/SECRET_PATH/tcp
endpoint: cloudflare.net:443
cipher: chacha20-ietf-poly1305
secret: SS_SECRET
udp:
$type: shadowsocks
endpoint:
$type: websocket
url: wss://legendary-faster-packs-und.trycloudflare.com/SECRET_PATH/udp
endpoint: cloudflare.net:443
cipher: chacha20-ietf-poly1305
secret: SS_SECRET
为了确保不同 Outline 客户端版本之间的兼容性,应在配置中使用 first-supported
选项。随着在 Outline 中添加新的策略和功能,这一点尤为重要,因为并非所有用户都已更新到最新的客户端软件。通过使用 first-supported
,您可以提供一个可在各种平台和客户端版本中无缝运行的单一配置,从而确保向后兼容性和一致的用户体验。
transport:
$type: tcpudp
tcp:
$type: shadowsocks
endpoint:
$type: first-supported
options:
- $type: websocket
url: wss://legendary-faster-packs-und.trycloudflare.com/SECRET_PATH/tcp
- ss.example.com:4321
cipher: chacha20-ietf-poly1305
secret: SS_SECRET
udp:
$type: shadowsocks
endpoint:
$type: first-supported
options:
- $type: websocket
url: wss://legendary-faster-packs-und.trycloudflare.com/SECRET_PATH/udp
- ss.example.com:4321
cipher: chacha20-ietf-poly1305
secret: SS_SECRET
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-06-18。
[null,null,["最后更新时间 (UTC):2025-06-18。"],[],["Outline configures VPN settings via YAML, defining `TunnelConfig` for TCP/UDP traffic. Shadowsocks is configured with endpoints, ciphers, and secrets. YAML anchors avoid duplication. Multi-hop setups are possible, using dialers to route through multiple servers. Shadowsocks-over-Websockets is supported to bypass protocol blocking, specifying URLs and optional endpoints. The `first-supported` option enables compatibility across Outline client versions by listing alternative configurations.\n"],null,["# Access Key Configuration\n\nOutline uses a YAML-based configuration to define VPN parameters and handle\nTCP/UDP traffic. The configuration supports composability at multiple levels,\nenabling flexible and extensible setups.\n\nThe top-level configuration specifies a\n[TunnelConfig](/outline/docs/reference/config#tunnelconfig).\n\nExamples\n--------\n\nA typical Shadowsocks configuration will look like this: \n\n transport:\n $type: tcpudp\n\n tcp:\n $type: shadowsocks\n endpoint: ss.example.com:80\n cipher: chacha20-ietf-poly1305\n secret: SECRET\n prefix: \"POST \" # HTTP request\n\n udp:\n $type: shadowsocks\n endpoint: ss.example.com:53\n cipher: chacha20-ietf-poly1305\n secret: SECRET\n prefix: \"\\u0097\\u00a7\\u0001\\u0000\\u0000\\u0001\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000\" # DNS query\n\nNote how we can now have TCP and UDP running on different ports or endpoints and\nwith different prefixes.\n\nYou can use YAML anchors and the `\u003c\u003c` merge key to avoid duplication: \n\n transport:\n $type: tcpudp\n\n tcp:\n \u003c\u003c: &shared\n $type: shadowsocks\n endpoint: ss.example.com:4321\n cipher: chacha20-ietf-poly1305\n secret: SECRET\n prefix: \"POST \"\n\n udp: *shared\n\nIt's now possible to compose strategies and do multi-hops: \n\n transport:\n $type: tcpudp\n\n tcp:\n $type: shadowsocks\n\n endpoint:\n $type: dial\n address: exit.example.com:4321\n dialer:\n $type: shadowsocks\n address: entry.example.com:4321\n cipher: chacha20-ietf-poly1305\n secret: ENTRY_SECRET\n\n cipher: chacha20-ietf-poly1305\n secret: EXIT_SECRET\n\n udp: *shared\n\nIn case of blocking of \"look-like-nothing\" protocols like Shadowsocks, you can\nuse Shadowsocks-over-Websockets. See the [server examnple\nconfiguration](https://github.com/Jigsaw-Code/outline-ss-server/blob/master/cmd/outline-ss-server/config_example.yml)\non how to deploy it. A client configuration will look like: \n\n transport:\n $type: tcpudp\n tcp:\n $type: shadowsocks\n endpoint:\n $type: websocket\n url: wss://legendary-faster-packs-und.trycloudflare.com/SECRET_PATH/tcp\n cipher: chacha20-ietf-poly1305\n secret: SS_SECRET\n\n udp:\n $type: shadowsocks\n endpoint:\n $type: websocket\n url: wss://legendary-faster-packs-und.trycloudflare.com/SECRET_PATH/udp\n cipher: chacha20-ietf-poly1305\n secret: SS_SECRET\n\nNote that the Websocket endpoint can, in turn, take an endpoint, which can be\nleveraged to bypass DNS-based blocking: \n\n transport:\n $type: tcpudp\n tcp:\n $type: shadowsocks\n endpoint:\n $type: websocket\n url: wss://legendary-faster-packs-und.trycloudflare.com/SECRET_PATH/tcp\n endpoint: cloudflare.net:443\n cipher: chacha20-ietf-poly1305\n secret: SS_SECRET\n\n udp:\n $type: shadowsocks\n endpoint:\n $type: websocket\n url: wss://legendary-faster-packs-und.trycloudflare.com/SECRET_PATH/udp\n endpoint: cloudflare.net:443\n cipher: chacha20-ietf-poly1305\n secret: SS_SECRET\n\nTo ensure compatibility across different Outline client versions, use the\n`first-supported` option in your configuration. This is particularly important\nas new strategies and features are added to Outline, as not all users may have\nupdated to the latest client software. By using `first-supported`, you can\nprovide a single configuration that works seamlessly across various platforms\nand client versions, ensuring backward compatibility and a consistent user\nexperience. \n\n transport:\n $type: tcpudp\n tcp:\n $type: shadowsocks\n endpoint:\n $type: first-supported\n options:\n - $type: websocket\n url: wss://legendary-faster-packs-und.trycloudflare.com/SECRET_PATH/tcp\n - ss.example.com:4321\n cipher: chacha20-ietf-poly1305\n secret: SS_SECRET\n\n udp:\n $type: shadowsocks\n endpoint:\n $type: first-supported\n options:\n - $type: websocket\n url: wss://legendary-faster-packs-und.trycloudflare.com/SECRET_PATH/udp\n - ss.example.com:4321\n cipher: chacha20-ietf-poly1305\n secret: SS_SECRET"]]