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

游戏加速器配置容器化(all-in-one)

我把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端口:

赞(3)
未经允许不得转载:荒岛 » 游戏加速器配置容器化(all-in-one)
分享到: 更多 (0)

评论 5

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

    硬件:网件R6300v2+旁路由 N1 Xbox
    环境:R6300v2 (梅林固件) + N1 (Armbian+Docker+OP),之前玩XB COD,PUBG直连均无问题,现在PUBG能玩,COD 无法启动,提示未启用网络

    求助:在有一台小鸡的情况下,如何进行配置,实现加速主机,畅玩COD,PUBG,看油管等 :cry:

    目前在考虑 OP下,SS+UDPSpeeder+UDP2RAW,不知有无更好方案

    李有田11个月前 (04-11) Microsoft Edge 111.0.1661.54 Microsoft Edge 111.0.1661.54 Windows 10 x64 Edition Windows 10 x64 Edition回复
    • 运营商如果没有qos就不用套udp2raw。有些协议对udp的支持是udp over tcp还不如用ss。

      LALA11个月前 (04-12) Google Chrome 111.0.0.0 Google Chrome 111.0.0.0 Windows 10 x64 Edition Windows 10 x64 Edition回复
  2. #2

    1.nano docker-compose.yml中的password和其他.json中的p4ssw0rd。没搞懂,两个部分都可以改?
    2.写死端口?.json中的端口感觉可以改。
    3.防火墙要开icmp?

    匿名8个月前 (06-14) Microsoft Edge 114.0.1823.43 Microsoft Edge 114.0.1823.43 Windows 10 x64 Edition Windows 10 x64 Edition回复
  3. #3

    冒险岛国际版还能用吗vps

    dual5个月前 (09-22) Google Chrome 117.0.0.0 Google Chrome 117.0.0.0 Mac OS X  10.15.7 Mac OS X 10.15.7回复

分享创造快乐

广告合作资源投稿