GOST SNI 分流

基于 Caddy 的 SNI 分流可参考 从 0 搭建一个 AnyTLS 节点(Caddy 分流, 自动维护证书)

▎安装

官方一键安装脚本 https://github.com/go-gost/gost

▎配置

/etc/gost/gost.yaml
a.foo.com -> 127.0.0.1:2053
其他 127.0.0.1:8443
services:
  - name: sni-router-443
    addr: ":443"
    handler: {type: tcp, metadata: {sniffing: true}}
    listener: {type: tcp}
    forwarder:
      nodes:
        - {name: caddy, addr: 127.0.0.1:2053, matcher: {rule: 'Host(`a.foo.com`)'}}
        - {name: fallback, addr: 127.0.0.1:8443}

log: {level: warn, format: text, output: stdout}


▎配置服务

编辑 /etc/systemd/system/gost.service:

[Unit]
Description=GOST SNI router
Documentation=https://gost.run/
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=gost
Group=gost
AmbientCapabilities=CAP_NET_BIND_SERVICE
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
NoNewPrivileges=true
ExecStart=/usr/local/bin/gost -C /etc/gost/gost.yaml
Restart=on-failure
RestartSec=3s
LimitNOFILE=1048576

[Install]
WantedBy=multi-user.target


▎启用服务

systemctl daemon-reload

systemctl enable --now gost


相关: GOST 端口转发教程

服务器合集 合集 群组 恰饭 联系推广

#GOST #分流 #SNI #教程 #服务器 #VPS #端口