饥荒联机版frp反代搭建
纯白的Fang
编辑于 2020年12月29日 04:37

反向代理,联机延迟低,体验良好。

原教程:

@NemoFrl 

@夏先生 

 ———————————

只是记录了自己需要的细节,作为教程不合适;

建议点进来的同学参考其他人更完善的教程!

cut-off

1.

设置并建好你的世界(带洞穴),创建成功后退出,注意存档栏位数

2.

下载安装xftp(用来向服务器传输文件)和xshell(用来输入指令控制服务器)

xftp新建会话,输入服务器ip、账户和密码,连接服务器;

xshell新建会话,同样输入服务器ip、账户和密码,连接服务器;

去steam工具里下载don't starve together Dedicated Server;

3.

xshell输入uname -a指令查看服务器系统架构,根据结果下载对应的最新版frp(github);

比如,若服务器输出显示aarch64,就要下载linux_arm64版本的frp(可自行搜索架构)。

客户端(我的电脑)是win10,下载window_amd64版本的。

分别解压出来;

4.

进入服务器对应的frp文件夹,修改frps.ini(服务器端配置):

[common]

bind_port = 7000

token=xxx(frp的密码,自己设置)

用xftp,在服务器的根目录建一个文件夹(命名frps),把frps.ini和frps.exe传进去。

在xshell里输入

cd frps

no hup ./frps -c ./frps.ini &

开启frp服务端。

*如果显示nohup: failed to run command...,则需要修改frps文件夹及里面文件的权限。

可以xftp右边右键更改权限,或者xshell里面用chmod指令。

5.

进入客户端对应的frp文件夹,修改frpc.ini如下:

[common]

server_addr = xxx.xxx.xxx.xxx(你的服务器ip)

server_port = 7000

token = xxx(和上面frps的密码相同)

[dst_master_udp]

type = udp

local_ip = 127.0.0.1

local_port = 10999

remote_port = 10999

[dst_cave_udp]

type = udp

local_ip = 127.0.0.1

local_port = 10998

remote_port = 10998

6.

在cmd中输入如下(需修改):

d:

cd D:/Download/frp_0.34.3_windows_amd64/frp_0.34.3_windows_amd64

frpc.exe -c frpc.ini

其中

d:是frpc文件夹所在的盘;

cd 进入frpc文件的目录。

如果等了一会显示connectex: A connection attempt failed,要登录服务器去改下安全组,udp,7000。

7.

进入刚才steam下载的dedicated server的bin目录,新建txt文件,输入

@echo off

start "Master&#​34; dontstarve_dedicated_server_nullrenderer -console -Cluster_1-shard Master

start "Caves&#​34; dontstarve_dedicated_server_nullrenderer -console -Cluster_1-shard Caves

保存并把txt后缀改成bat,创建个快捷方式放桌面

8.

进游戏,在线模式,(换英文输入法)打开控制台,输入

TheNet:GenerateClusterToken()

回车确定,生成了token,

进dst的存档目录(文档\Klei\DoNotStarveTogether\一串数字),找到cluster_token.txt复制,

返回上一级,进入Cluster_1(这个数字对应联机的存档栏位)文件夹,粘贴。

9.

mods:

主机订阅mod后,将游戏目录mod文件夹里的mod复制到dedicated server目录中的mod文件夹里

(这样更新mod实在是不方便)

10.

玩的时候启动反代,启动服务器;

客户端在控制台输入

c_connect("服务器ip&#​34;,10999)

进入房间开始联机。