静看光阴荏苒
不管不顾不问不说也不念

verysimple:一个对标 v2ray/xray的极简代理内核

这篇文章记录一下用verysimple配置一个trojan协议的代理,并使用nginx的ngx_stream_ssl_preread模块进行sni分流。首先安装需要用到的包:

apt -y update
apt -y install xz-utils curl nginx

下载verysimple:

mkdir -p /usr/local/etc/verysimple
curl -L https://github.com/e1732a364fed/v2ray_simple/releases/download/v1.2.4-beta.2/verysimple_linux_amd64.tar.xz -o verysimple_linux_amd64.tar.xz
tar xf verysimple_linux_amd64.tar.xz -C /usr/local/etc/verysimple
mv /usr/local/etc/verysimple/verysimple /usr/local/bin

新建systemd服务:

nano /etc/systemd/system/verysimple.service

写入如下配置:

[Unit]
Description=verysimple service
Documentation=https://github.com/e1732a364fed/v2ray_simple
After=network.target

[Service]
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
ExecStart=/usr/local/bin/verysimple -c /usr/local/etc/verysimple/server.toml
Restart=on-failure
RestartSec=1800s
LimitNOFILE=infinity

[Install]
WantedBy=multi-user.target

新建一个verysimple的配置文件:

nano /usr/local/etc/verysimple/server.toml

写入如下配置:

[[listen]]
protocol = "trojans"
uuid = "036514da-75fd-4e36-9ca9-229617fd3b4c"

ip = "127.0.0.1"
host = "trojan.example.com"
port = 62000
sniffing.enabled = true
cert = "/usr/local/etc/verysimple/trojan.example.com.pem"
key = "/usr/local/etc/verysimple/trojan.example.com.key"
insecure = false
extra = { tls_minVersion = "1.2" }
xver = 2
fullcone = true

[[fallback]]
dest = 23333
xver = 2

[[dial]]
protocol = "direct"
fullcone = true

启动verysimple并设置开机自启:

systemctl enable --now verysimple

编辑nginx的主配置文件:

nano /etc/nginx/nginx.conf

写入如下配置:

stream {
        map $ssl_preread_server_name $verysimple {
                trojan.example.com trojan;
        }
        upstream trojan {
                server 127.0.0.1:62000;
        }
        server {
                listen 443      reuseport;
                listen [::]:443 reuseport;
                proxy_pass      $verysimple;
                ssl_preread     on;
                proxy_protocol  on;
        }
}

新建一个nginx站点配置文件,用于回落站点:

nano /etc/nginx/conf.d/fallback.conf

写入如下配置:

server {
        listen 80;
        server_name trojan.example.com;
        if ($host = trojan.example.com) {
                return 301 https://$host$request_uri;
        }
        return 404;
}

server {
        listen 127.0.0.1:23333 proxy_protocol;
        set_real_ip_from 127.0.0.1;
        real_ip_header proxy_protocol;
        server_name trojan.example.com;
        index index.html;
        root /var/www/html/flappyfrog;
}

重载nginx使配置生效:

systemctl reload nginx

服务端至此全部配置完成,在这里下载客户端:https://github.com/e1732a364fed/v2ray_simple/releases

建议目前先下载v1.2.4-beta.2版本使用。verysimple客户端的配置:

[[listen]]
protocol = "socks5"
host = "127.0.0.1"
port = 50800
sniffing.enabled = true

[[dial]]
tag = "proxy"
protocol = "trojans"
uuid = "036514da-75fd-4e36-9ca9-229617fd3b4c"
host = "trojan.example.com"
port = 443
insecure = false
utls = true
use_mux = true

[[dial]]
tag = "direct"
protocol = "direct"

[[route]]
country = ["CN"]
ip = ["private"]
domain = ["geosite:cn"]
toTag = "direct"

因为配置了route,需要用到GeoLite2-Country.mmdb和geosite,先启动一次加上-d参数让程序把这些文件下载下来:

cd C:\Users\LALA\Desktop\verysimple
.\verysimple.exe -c trojan.client.toml -d

之后退出再运行即可:

.\verysimple.exe -c trojan.client.toml

verysimple的fallback功能很完善,支持proxy_protocol,所以回落站点可以获取到真实的访客ip,用浏览器访问一下你的域名,再看看nginx的access日志即可发现记录的ip是真实ip:

赞(20)
未经允许不得转载:荒岛 » verysimple:一个对标 v2ray/xray的极简代理内核
分享到: 更多 (0)

评论 14

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #1

    lala 有没有这种
    https://ww1.k00ppc.com/ADF4D95451E60B721C29CAC2D397E90A78CB21E3
    https://up.91dfjh.com/
    专门分享磁力.torrent 的源码 :cry:

    losie2年前 (2022-10-06) Google Chrome 106.0.0.0 Google Chrome 106.0.0.0 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 看看这个:https://github.com/nyaadevs/nyaa

      LALA2年前 (2022-10-06) Google Chrome 104.0.0.0 Google Chrome 104.0.0.0 Windows 10 x64 Edition Windows 10 x64 Edition回复
      • lala 你的rocket chat怎么不见了,好久不来了。怎么联系你

        天空中最亮的星1年前 (2022-12-22) Google Chrome 108.0.0.0 Google Chrome 108.0.0.0 Windows 10 x64 Edition Windows 10 x64 Edition回复
        • rocketchat换成mattermost了,右上角的聊天室就是。

          LALA1年前 (2022-12-23) Google Chrome 107.0.0.0 Google Chrome 107.0.0.0 Windows 10 x64 Edition Windows 10 x64 Edition回复
  2. #2

    老哥你悠着点, 太高产小心逗比拿样被盯上

    miaosky2年前 (2022-10-07) Google Chrome 86.0.4240.198 Google Chrome 86.0.4240.198 Windows 10 x64 Edition Windows 10 x64 Edition回复
  3. #3

    大佬有时间再水一篇 trojan 或者 trojan-go 的文章吧 搜索了一下您这儿单纯有关 trojan 的部署只有一篇 18年的老文 其他都是相关协议的 菜B想抄作业 只能请大佬关照了 :eek:

    x-er2年前 (2022-10-14) Google Chrome 102.0.0.0 Google Chrome 102.0.0.0 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 网上虽然很多但基本全是一键部署 还是大佬您的说明比较简单有效… :lol:

      x-er2年前 (2022-10-14) Google Chrome 102.0.0.0 Google Chrome 102.0.0.0 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 并不一定非要用trojan或者trojan-go啊,现在很多工具都支持trojan协议,你单纯想用trojan的话,v2ray/xray/sing-box,包括这篇文章的verysimple都支持,你随便用哪个部署服务端和用原版的trojan没多大区别的。

      LALA2年前 (2022-10-17) Google Chrome 106.0.0.0 Google Chrome 106.0.0.0 Windows 10 x64 Edition Windows 10 x64 Edition回复
  4. #4

    大佬,你这是什么版本的系统啊,nginx默认带了ngx_stream_ssl_preread模块吗?

    CooleR2年前 (2022-10-25) Microsoft Edge 106.0.1370.52 Microsoft Edge 106.0.1370.52 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 系统是debian11,debian官方源里面的nginx默认就有这个模块的。

      LALA1年前 (2022-10-29) Google Chrome 106.0.0.0 Google Chrome 106.0.0.0 Windows 10 x64 Edition Windows 10 x64 Edition回复
      • 明白了,谢谢

        CooleR1年前 (2022-11-04) Microsoft Edge 107.0.1418.26 Microsoft Edge 107.0.1418.26 Windows 10 x64 Edition Windows 10 x64 Edition回复
  5. #5

    这个代理工具好有意思啊。一看就喜欢上了。可惜现在还是资料太少。

    pony331年前 (2022-12-03) Firefox 107.0 Firefox 107.0 GNU/Linux x64 GNU/Linux x64回复
  6. #6

    有没有支持cdn的verysimple的trojan配置?

    oojj@gpio.net1年前 (2022-12-06) Google Chrome 108.0.0.0 Google Chrome 108.0.0.0 Windows 7 x64 Edition Windows 7 x64 Edition回复

分享创造快乐

广告合作资源投稿