游戏加速器配置容器化(all-in-one)|udp2raw+udpspeeder+kcptun+shadowsocks

实用教程 admin 来源:荒岛 2年前 (2023-03-23) 859次浏览 0个评论

我把udp2raw/udpspeeder/kcptun/shadowsocks都塞到了一个docker镜像里面,方便自己日常部署和使用,毕竟每次换服务器都要重新搭建一遍属实有点麻烦。

这个docker镜像目前比较简陋,只支持设置各个工具的密码,端口号什么的都是写死的。但我也不打算再增加新的功能了,因为就我自己用,我需求很简单,能跑起来就行。

all-in-one?all-in-boom!如果需要手动搭建可看这篇文章

准备目录:

mkdir -p /opt/docker-game-speed && cd /opt/docker-game-speed

新建Dockerfile:

nano Dockerfile

写入如下内容:

FROM debian:bullseye-slim

ARG SHADOWSOCKS_VERSION=v1.15.3
ARG KCPTUN_VERSION=20230214
ARG UDP2RAW_VERSION=20230206.0
ARG UDPSPEEDER_VERSION=20230206.0

WORKDIR /app

RUN set -ex \
 && apt update \
 && apt install -y --no-install-recommends ca-certificates curl xz-utils iptables supervisor \
 && rm -rf /var/lib/apt/lists/* \
 && curl -L https://github.com/shadowsocks/shadowsocks-rust/releases/download/${SHADOWSOCKS_VERSION}/shadowsocks-${SHADOWSOCKS_VERSION}.x86_64-unknown-linux-gnu.tar.xz -o shadowsocks-${SHADOWSOCKS_VERSION}.tar.xz \
 && curl -L https://github.com/xtaci/kcptun/releases/download/v${KCPTUN_VERSION}/kcptun-linux-amd64-${KCPTUN_VERSION}.tar.gz -o kcptun-${KCPTUN_VERSION}.tar.gz \
 && curl -L https://github.com/wangyu-/udp2raw/releases/download/${UDP2RAW_VERSION}/udp2raw_binaries.tar.gz -o udp2raw_binaries.tar.gz \
 && curl -L https://github.com/wangyu-/UDPspeeder/releases/download/${UDPSPEEDER_VERSION}/speederv2_binaries.tar.gz -o speederv2_binaries.tar.gz \
 && tar -xvf shadowsocks-${SHADOWSOCKS_VERSION}.tar.xz ssserver \
 && tar -xzvf kcptun-${KCPTUN_VERSION}.tar.gz server_linux_amd64 \
 && tar -xzvf udp2raw_binaries.tar.gz udp2raw_amd64 \
 && tar -xzvf speederv2_binaries.tar.gz speederv2_amd64 \
 && rm -rf shadowsocks-${SHADOWSOCKS_VERSION}.tar.xz \
 && rm -rf kcptun-${KCPTUN_VERSION}.tar.gz \
 && rm -rf udp2raw_binaries.tar.gz \
 && rm -rf speederv2_binaries.tar.gz

COPY shadowsocks.json /app/shadowsocks.json
COPY kcptun.json /app/kcptun.json
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY docker-entrypoint.sh /app/docker-entrypoint.sh

EXPOSE 50000 50001 60000 60001 60002

ENTRYPOINT ["/app/docker-entrypoint.sh"]

CMD ["/usr/bin/supervisord"]

新建compose:

nano docker-compose.yml

写入如下内容:

version: '3.8'

services:
  all-in-one:
    build: .
    container_name: game
    restart: unless-stopped
    network_mode: "host"
    cap_add:
      - NET_ADMIN
    environment:
      - SHADOWSOCKS_PASSWORD=password
      - KCPTUN_PASSWORD=password
      - UDPSPEEDER_PASSWORD=password
      - UDP2RAW_PASSWORD=password

新建docker入口点脚本文件:

nano docker-entrypoint.sh

写入如下内容:

#!/bin/sh

if [ $SHADOWSOCKS_PASSWORD ];then
    sed -i "s#shad0ws0cksp4ssw0rd#$SHADOWSOCKS_PASSWORD#g" /app/shadowsocks.json
else
    echo "shadowsocks default password: shad0ws0cksp4ssw0rd"
fi

if [ $KCPTUN_PASSWORD ];then
    sed -i "s#kcptunp4ssw0rd#$KCPTUN_PASSWORD#g" /app/kcptun.json
else
    echo "kcptun default password: kcptunp4ssw0rd"
fi

if [ $UDPSPEEDER_PASSWORD ];then
    sed -i "s#udpspeederp4ssw0rd#$UDPSPEEDER_PASSWORD#g" /etc/supervisor/conf.d/supervisord.conf
else
    echo "udpspeeder default password: udpspeederp4ssw0rd"
fi

if [ $UDP2RAW_PASSWORD ];then
    sed -i "s#udp2rawp4ssw0rd#$UDP2RAW_PASSWORD#g" /etc/supervisor/conf.d/supervisord.conf
else
    echo "udp2raw default password: udp2rawp4ssw0rd"
fi

exec "$@"

给执行权限:

chmod +x docker-entrypoint.sh

新建kcptun配置文件:

nano kcptun.json

写入如下配置:

{
    "listen": ":60001",
    "target": "127.0.0.1:60002",
    "key": "kcptunp4ssw0rd",
    "crypt": "salsa20",
    "mode": "fast3",
    "mtu": 1350,
    "sndwnd": 2048,
    "rcvwnd": 2048,
    "datashard": 2,
    "parityshard": 2,
    "dscp": 46,
    "nocomp": true
}

新建shadowsocks配置文件:

nano shadowsocks.json

写入如下配置:

{
    "server": "0.0.0.0",
    "server_port": 60002,
    "password": "shad0ws0cksp4ssw0rd",
    "method": "aes-256-gcm",
    "mode": "tcp_and_udp"
}

新建supervisor配置文件:

nano supervisord.conf

写入如下配置:

[supervisord]
nodaemon=true

[program:udp2raw-kcptun]
command=/app/udp2raw_amd64 -s -l 0.0.0.0:60000 -r 127.0.0.1:60001 --raw-mode icmp --cipher-mode none -a -k "udp2rawp4ssw0rd"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0

[program:kcptun]
command=/app/server_linux_amd64 -c /app/kcptun.json
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
redirect_stderr=true

[program:udp2raw-udpspeeder]
command=/app/udp2raw_amd64 -s -l 0.0.0.0:50000 -r 127.0.0.1:50001 --raw-mode icmp --cipher-mode none -a -k "udp2rawp4ssw0rd"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0

[program:udpspeeder]
command=/app/speederv2_amd64 -s -l 0.0.0.0:50001 -r 127.0.0.1:60002 -f 2:4 -k "udpspeederp4ssw0rd"
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0

[program:shadowsocks]
command=/app/ssserver -c /app/shadowsocks.json
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
redirect_stderr=true

构建镜像:

docker compose build

启动:

docker compose up -d

客户端:

.\udp2raw_mp_nolibnet.exe -c -l 0.0.0.0:60000 -r VPSIP:60000 --raw-mode icmp --cipher-mode none -k "udp2rawp4ssw0rd"
.\udp2raw_mp_nolibnet.exe -c -l 0.0.0.0:50000 -r VPSIP:50000 --raw-mode icmp --cipher-mode none -k "udp2rawp4ssw0rd"
.\client_windows_amd64.exe -l :12345 -r 127.0.0.1:60000 -key "kcptunp4ssw0rd" -crypt salsa20 -nocomp -datashard 2 -parityshard 2 -mtu 1350 -sndwnd 512 -rcvwnd 2048 -dscp 46 -mode fast3
.\speederv2_wepoll.exe -c -l 0.0.0.0:12345 -r 127.0.0.1:50000 -f 2:4 -k "udpspeederp4ssw0rd"

netch配置ss连接本地的12345端口:


原文:

https://lala.im/8634.html


VPS小白 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:游戏加速器配置容器化(all-in-one)|udp2raw+udpspeeder+kcptun+shadowsocks
喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

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

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址