sing-box 网络代理平台的“瑞士军刀”,搭建shadowtls节点

实用教程 admin 来源:原文链接 2年前 (2022-09-25) 4447次浏览 3个评论

说起网络代理工具大家第一时间想到的应该是v2ray和clash,最近又有另一个非常火的网络代理工具出现了,sing-box,和v2ray属于同一种类型的工具,但是sing-box对协议支持的丰富程度可以说无人能及,本期教程就来带大家简单上手sing-box,使用sing-box搭建一个非常骚的shadowtls节点

视频教程


安装sing-box

官方文档:https://sing-box.sagernet.org/
下载sing-box:wget https://github.com/SagerNet/sing-box/releases/download/v1.0.4/sing-box_1.0.4_linux_amd64.deb

最新版请在项目官方地址获取:https://github.com/SagerNet/sing-box/releases/latest

安装sing-box:dpkg -i sing-box_1.0.4_linux_amd64.deb

查看安装包内容:dpkg -c sing-box_1.0.4_linux_amd64.deb

修改配置文件:vim /etc/sing-box/config.json

查看sing-box状态:systemctl status sing-box.service

启动sing-box:systemctl start sing-box.service

sing-box服务端shadowtls配置

{
  "inbounds": [
    {
      "type": "shadowtls",
      "listen_port": 443,
      "handshake": {
        "server": "www.bing.com",
        "server_port": 443 
      },
      "detour": "shadowsocks-in"
    },
    {
      "type": "shadowsocks",
      "tag": "shadowsocks-in",
      "listen": "127.0.0.1",
      "method": "2022-blake3-aes-128-gcm",
      "password": "8JCsPssfgS8tiRwiMlhARg=="
    }
  ]
}

sing-box客户端shadowtls配置

socks/http代理模式

{
  "inbounds": [
    {
      "type": "mixed",
      "listen_port": 1080,
      "sniff": true,
      "set_system_proxy": true
    }
  ],
  "outbounds": [
    {
      "type": "shadowsocks",
      "method": "2022-blake3-aes-128-gcm",
      "password": "8JCsPssfgS8tiRwiMlhARg==",
      "detour": "shadowtls-out",
      "multiplex": {
        "enabled": true,
        "max_connections": 4,
        "min_streams": 4
      }
    },
    {
      "type": "shadowtls",
      "tag": "shadowtls-out",
      "server": "填写服务器ip地址",
      "server_port": 443,
      "tls": {
        "enabled": true,
        "server_name": "www.bing.com"
      }
    },
    {
      "type": "direct",
      "tag": "direct"
    },
    {
      "type": "block",
      "tag": "block"
    }
  ],
  "route": {
    "rules": [
      {
        "geosite": "category-ads-all",
        "outbound": "block"
      },
      {
        "geosite": "cn",
        "geoip": "cn",
        "outbound": "direct"
      }
    ]
  }
}

TUN模式

{
  "dns": {
    "servers": [
      {
        "tag": "google",
        "address": "tls://8.8.8.8"
      },
      {
        "tag": "local",
        "address": "223.5.5.5",
        "detour": "direct"
      }
    ],
    "rules": [
      {
        "geosite": "cn",
        "server": "local"
      }
    ],
    "strategy": "ipv4_only"
  },
  "inbounds": [
    {
      "type": "tun",
      "inet4_address": "172.19.0.1/30",
      "auto_route": true,
      "sniff": true
    }
  ],
  "outbounds": [
    {
      "type": "shadowsocks",
      "method": "2022-blake3-aes-128-gcm",
      "password": "8JCsPssfgS8tiRwiMlhARg==",
      "detour": "shadowtls-out",
      "multiplex": {
        "enabled": true,
        "max_connections": 4,
        "min_streams": 4
      }
    },
    {
      "type": "shadowtls",
      "tag": "shadowtls-out",
      "server": "填写服务器ip地址",
      "server_port": 443,
      "tls": {
        "enabled": true,
        "server_name": "www.bing.com"
      }
    },
    {
      "type": "direct",
      "tag": "direct"
    },
    {
      "type": "block",
      "tag": "block"
    },
    {
      "type": "dns",
      "tag": "dns-out"
    }
  ],
  "route": {
    "rules": [
      {
        "protocol": "dns",
        "outbound": "dns-out"
      },
      {
        "geosite": "category-ads-all",
        "outbound": "block"
      },
      {
        "geosite": "cn",
        "geoip": "cn",
        "outbound": "direct"
      }
    ],
    "auto_detect_interface": true
  }
}

VPS小白 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:sing-box 网络代理平台的“瑞士军刀”,搭建shadowtls节点
喜欢 (3)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(3)个小伙伴在吐槽
  1. 这套配置在我在联通上面已经不通了。。。vultr家的vps
    网络小白2022-11-05 13:30 回复
  2. 没说全吧,还要搭建ss?
    wang2023-04-26 09:53 回复