加载中...

sing-box自建ShadowTlsV3和Vlessreality节点,并设置国内外分流配置示例!


环境依赖安装sudo和curl

apt install curl

apt install sudo -y

singbox 官方一键脚本 debian/unbutu

bash <(curl -fsSL https://sing-box.app/deb-install.sh)

singbox 重启

systemctl restart sing-box

singbox 实时日志

journalctl -u sing-box --output cat -f

singbox状态

systemctl status sing-box.service

singbox生成UUID

sing-box generate uuid

singbox生成公钥私钥

sing-box generate reality-keypair

2022-blake3-aes-128-gcm密码生成

openssl rand -base64 16

singbox 服务端配置ShadowTls3,VlessReality节点配置示例

singbox版本1.11.0+

{
    "log": {
        "disabled": true
    },
    "inbounds": [
        {
            "type": "shadowtls",
            "listen": "::",
            "listen_port": 59209,//端口自定义小于60000
            "version": 3,
            "users": [
                {
                    "name": "sakia",
                    "password": "******" //自定义密码
                }
            ],
            "handshake": {
                "server": "itunes.apple.com", //自定义域名
                "server_port": 443
            },
            "strict_mode": true,
            "detour": "shadowsocks-in"
        },
        {
            "type": "shadowsocks",
            "tag": "shadowsocks-in",
            "listen": "127.0.0.1",
            "network": "tcp",
            "method": "2022-blake3-aes-128-gcm",
            "password": "********" //自定义16位长度密码,符合格式
      },
      {
        "type": "vless",
        "tag": "vless-in",
        "listen": "::",
        "listen_port": 443,//自定义端口,和上面的shadowtls端口不要冲突
        "users": [
            {
                "uuid": "********",//填写UUID
                "flow": "xtls-rprx-vision"
            }
        ],
        "tls": {
            "enabled": true,
            "server_name": "itunes.apple.com",
            "reality": {
                "enabled": true,
                "handshake": {
                    "server": "itunes.apple.com",
                    "server_port": 443
                },
                "private_key": "***********",//填写私钥
                "short_id": [
                    ""
                ]
            }
        }
    }
    ],
    "outbounds": [
        {
            "type": "direct",
            "tag": "direct"
        }
    ],
    "route": {
        "rules": [
            {
                "inbound": [
                    "vless-in"
                ],
                "outbound": "direct"
            },
            {
                "inbound": [
                    "shadowsocks-in"
                ],
                "outbound": "direct"
            }
        ]
    },
    "experimental": {
        "cache_file": {
            "enabled": true
        },
        "clash_api": {
            "external_controller": "0.0.0.0:9090",
            "secret": "",
            "external_ui": "metacubexd",
            "external_ui_download_detour": "direct",
            "default_mode": "rule"
        }
    }
  }

singbox 客户端示例代码(包含singbox国内外分流规则)。

适用singbox版本1.11.0+

{
    "log": {
      "level": "info",
      "timestamp": true,
      "disabled": true
    },
    "dns": {
      "servers": [
        {
          "tag": "proxy_dns",
          "address": "https://1.1.1.1/dns-query",
          "detour": "AUTO"
        },
        {
          "tag": "local_dns",
          "address": "https://223.6.6.6/dns-query",
          "detour": "direct"
        }
      ],
      "rules": [
        {
          "domain_keyword": [
            "your-server-keyword_1",
            "your-server-keyword_2",
            "your-server-keyword_3"
          ],
          "server": "local_dns"
        },
        {
          "rule_set": [
            "ChinaMax_All",
            "WeChat.srs"
          ],
          "server": "local_dns"
        },
        {
          "clash_mode": "direct",
          "server": "local_dns"
        },
        {
          "clash_mode": "global",
          "server": "proxy_dns"
        }
      ],
      "final": "proxy_dns"
    },
    "inbounds": [
      {
        "type": "tun",
        "tag": "tun-in",
        "interface_name": "utun0",
        "address": [
          "172.19.0.1/30",
          "fdfe:dcba:9876::1/126"
        ],
        "mtu": 9000,
        "auto_route": true,
        "strict_route": true,
        "stack": "system",
        "platform": {
          "http_proxy": {
            "enabled": true,
            "server": "127.0.0.1",
            "server_port": 2080
          }
        }
      },
      {
        "type": "mixed",
        "tag": "mixed-in",
        "listen": "127.0.0.1",
        "listen_port": 2080,
        "sniff": true,
        "users": []
      }
    ],
    "outbounds": [
      {
        "tag": "AUTO",
        "type": "urltest",
        "outbounds": [
          "server-1",
          "server-2"
        ],
        "url": "http://www.gstatic.com/generate_204",
        "interval": "10m",
        "tolerance": 100
      },
      {
        "tag": "OpenAI",
        "type": "selector",
        "outbounds": [
          "direct",
          "server-1",
          "server-2"
        ]
      },
      {
        "tag": "Telegram",
        "type": "selector",
        "outbounds": [
          "direct",
          "server-1",
          "server-2"
        ]
      },
      {
        "tag": "Youtube",
        "type": "selector",
        "outbounds": [
          "direct",
          "server-1",
          "server-2"
        ]
      },
      {
        "tag": "Microsoft",
        "type": "selector",
        "outbounds": [
          "direct",
          "server-1",
          "server-2"
        ]
      },
      {
        "tag": "G-Services",
        "type": "selector",
        "outbounds": [
          "direct",
          "server-1",
          "server-2"
        ]
      },
      {
        "tag": "Metaverse",
        "type": "selector",
        "outbounds": [
          "direct",
          "server-1",
          "server-2"
        ]
      },
      {
        "tag": "China",
        "type": "selector",
        "outbounds": [
          "direct",
          "server-1",
          "server-2"
        ]
      },
      {
        "type": "vless",
        "tag": "server-2",
        "uuid": "***",//填写UUID
        "flow": "xtls-rprx-vision",
        "packet_encoding": "xudp",
        "server": "***",//填写你的服务器IP
        "server_port": 443,
        "tls": {
          "enabled": true,
          "server_name": "itunes.apple.com",
          "utls": {
            "enabled": true,
            "fingerprint": "chrome"
          },
          "reality": {
            "enabled": true,
            "public_key": "****",//自定义公钥
            "short_id": ""
          }
        }
      },
      {
        "tag": "server-1",
        "type": "shadowsocks",
        "method": "2022-blake3-aes-128-gcm",
        "password": "**********", //自定义16位长度密码
        "detour": "shadowtls-out",
        "udp_over_tcp": {
          "enabled": true,
          "version": 3
        }
      },
      {
        "type": "shadowtls",
        "tag": "shadowtls-out",
        "server": "*****",//你的服务器IP
        "server_port": 443,//
        "version": 3,
        "password": "****",//自定义密码
        "tls": {
          "enabled": true,
          "server_name": "bing.com",
          "utls": {
            "enabled": true,
            "fingerprint": "firefox"
          }
        }
      },
      {
        "type": "direct",
        "tag": "direct"
      }
    ],
    "route": {
      "rules": [
        {
          "action": "sniff"
        },
        {
          "protocol": "dns",
          "action": "hijack-dns"
        },
        {
          "clash_mode": "direct",
          "outbound": "direct"
        },
        {
          "clash_mode": "global",
          "outbound": "Metaverse"
        },
        {
          "domain": [
            "clash.razord.top",
            "yacd.metacubex.one",
            "yacd.haishan.me",
            "d.metacubex.one"
          ],
          "outbound": "direct"
        },
        {
          "rule_set": "OpenAI.srs",
          "outbound": "OpenAI"
        },
        {
          "rule_set": "Telegram.srs",
          "outbound": "Telegram"
        },
        {
          "rule_set": "YouTube.srs",
          "outbound": "Youtube"
        },
        {
          "rule_set": "Microsoft.srs",
          "outbound": "Microsoft"
        },
        {
          "rule_set": "Google.srs",
          "outbound": "G-Services"
        },
        {
          "rule_set": "Global_All",
          "outbound": "Metaverse"
        },
        {
          "rule_set": [
            "ChinaMax_All",
            "WeChat.srs",
            "geoip-cn",
            "geosite-cn"
          ],
          "outbound": "China"
        },
        {
          "ip_is_private": true,
          "outbound": "China"
        }
      ],
      "auto_detect_interface": true,
      "final": "Metaverse",
      "rule_set": [
        {
          "tag": "geoip-cn",
          "type": "remote",
          "format": "binary",
          "url": "https://raw.githubusercontent.com/SagerNet/sing-geoip/rule-set/geoip-cn.srs",
          "download_detour": "AUTO"
        },
      {
        "tag": "geosite-cn",
        "type": "remote",
        "format": "binary",
        "url": "https://testingcf.jsdelivr.net/gh/MetaCubeX/meta-rules-dat@sing/geo/geosite/cn.srs",
        "download_detour": "AUTO"
      }, 
      {
        "tag": "ChinaMax_All",
        "type": "remote",
        "format": "binary",
        "url": "https://raw.githubusercontent.com/tangnahuaite/sing-box_Route-rules/main/rule_srs/ChinaMax_All.srs",
        "download_detour": "AUTO"
      },
      {
        "tag": "Global_All",
        "type": "remote",
        "format": "binary",
        "url": "https://raw.githubusercontent.com/tangnahuaite/sing-box_Route-rules/main/rule_srs/Global_All.srs",
        "download_detour": "AUTO"
      },
      {
        "tag": "Google.srs",
        "type": "remote",
        "format": "binary",
        "url": "https://raw.githubusercontent.com/tangnahuaite/sing-box_Route-rules/main/rule_srs/Google.srs",
        "download_detour": "AUTO"
      },
      {
        "tag": "Microsoft.srs",
        "type": "remote",
        "format": "binary",
        "url": "https://raw.githubusercontent.com/tangnahuaite/sing-box_Route-rules/main/rule_srs/Microsoft.srs",
        "download_detour": "AUTO"
      },
      {
        "tag": "OpenAI.srs",
        "type": "remote",
        "format": "binary",
        "url": "https://raw.githubusercontent.com/tangnahuaite/sing-box_Route-rules/main/rule_srs/OpenAI.srs",
        "download_detour": "AUTO"
      },
      {
        "tag": "Telegram.srs",
        "type": "remote",
        "format": "binary",
        "url": "https://raw.githubusercontent.com/tangnahuaite/sing-box_Route-rules/main/rule_srs/Telegram.srs",
        "download_detour": "AUTO"
      },
      {
        "tag": "WeChat.srs",
        "type": "remote",
        "format": "binary",
        "url": "https://raw.githubusercontent.com/tangnahuaite/sing-box_Route-rules/main/rule_srs/WeChat.srs",
        "download_detour": "AUTO"
      },
      {
        "tag": "YouTube.srs",
        "type": "remote",
        "format": "binary",
        "url": "https://raw.githubusercontent.com/tangnahuaite/sing-box_Route-rules/main/rule_srs/YouTube.srs",
        "download_detour": "AUTO"
      }
    ]
  }
  }

文章作者: 阿瓜
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 阿瓜 !
 本篇
sing-box自建ShadowTlsV3和Vlessreality节点,并设置国内外分流配置示例! sing-box自建ShadowTlsV3和Vlessreality节点,并设置国内外分流配置示例!
如何在singbox设置国内外分流规则,并且搭建VlessReality节点和ShadowTlsV3节点。
下一篇 
MetaTrader5 的小白使用教程! MetaTrader5 的小白使用教程!
大家好!今天我们来学习如何下载并安装MT5软件,并且成功登录到经纪商平台。让我们一步一步来,你会发现其实很简单!