vps交流

[经验] singbox服务端分流


一直想搞分流,在ytb上搜了搜,简单易懂的都是基于xray,可我并不使用x,因为嫌弃它太占用内存。
于是开始找singbox教程,最终功夫不负有心人,成功搞定在singbox的服务端实现分流。

我使用的是233boy大佬的一键脚本,配置文件位置:/etc/sing-box/conf,我是基于入口来搞定的分流,singbox的配置config.json应该也可以,但我没尝试。

完整代码如下:

  1. {
  2.   "inbounds": [
  3.     {
  4.       "tag": "标签",
  5.       "type": "shadowsocks",
  6.       "listen": "::",
  7.       "listen_port": 端口,
  8.       "method": "加密方式",
  9.       "password": "密码"
  10.     }
  11.   ],
  12.   "outbounds": [
  13.     {
  14.       "type": "direct",
  15.       "tag": "direct-out"
  16.     },
  17.     {
  18.       "type": "shadowsocks",
  19.       "tag": "proxy-chatgpt",
  20.       "server": "IP地址",
  21.       "server_port": 端口,
  22.       "method": "加密方式",
  23.       "password": "密码",
  24.       "udp_over_tcp": false
  25.     },
  26.     {
  27.       "type": "block",
  28.       "tag": "block-out"
  29.     }
  30.   ],
  31.   "route": {
  32.     "rules": [
  33.       {
  34.         "domain_keyword": [
  35.           "chatgpt",
  36.           "openai"
  37.         ],
  38.         "outbound": "proxy-chatgpt"
  39.       },
  40.       {
  41.         "geoip": [
  42.           "private"
  43.         ],
  44.         "outbound": "direct-out"
  45.       },
  46.       {
  47.         "geoip": [
  48.           "cn"
  49.         ],
  50.         "outbound": "direct-out"
  51.       },
  52.       {
  53.         "domain_suffix": [
  54.           "cn"
  55.         ],
  56.         "outbound": "direct-out"
  57.       }
  58.     ],
  59.     "final": "direct-out"
  60.   }
  61. }

复制代码

替换原来的json文件,而后重启singbox即可。
访问网址中包含chatgpt相关则走代理。
平日用自己的节点,当需要解锁chtgpt的时候走机场节点。
我也没什么需求,一般常用就是chatgpt,有其他奈飞或者ytb可以自己添加关键词。

最后不得不说一句,singbox真好用, 占用挺低,不满意的就是随着tcp、udp的连接内存会居高不下,我的解决办法是crontab 一小时重启一次singbox即可。

bg
都是十几二十M的GO程序还嫌什么内存大,笑死人
赞(0)
版权声明:本贴采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
帖子名称:《[经验] singbox服务端分流》
帖子链接:https://bbs.toot.su/185635.html

相关推荐