Skip to content

Commit 32ada9a

Browse files
committed
Merge branch 'dev-1.2-beta3' into dev
2 parents 5b37edd + ce99439 commit 32ada9a

36 files changed

+1169
-841
lines changed

.github/workflows/release.yml

Lines changed: 60 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,71 @@ jobs:
1818
sudo apt upgrade -y
1919
- name: Install toolchain
2020
run: |
21-
sudo apt install -y gcc gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu
22-
sudo mv /etc/apt/sources.list /etc/apt/sources.list.d/main-amd64.list
21+
sudo apt install -y gcc gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf gcc-powerpc64le-linux-gnu gcc-riscv64-linux-gnu gcc-s390x-linux-gnu
22+
sudo mv /etc/apt/sources.list /etc/apt/sources.list.d/main.list
2323
sudo touch /etc/apt/sources.list
24-
sudo sed -i '/^$/d;/^#/d;s/deb/deb [arch=amd64]/g' /etc/apt/sources.list.d/main-amd64.list
25-
sudo cp /etc/apt/sources.list.d/main-amd64.list /etc/apt/sources.list.d/main-arm.list
26-
sudo sed -i 's/arch=amd64/arch=armhf,arm64/g;s/archive/ports/g;s/security\./security.ports./g;s/\/ubuntu/\/ubuntu-ports/g' /etc/apt/sources.list.d/main-arm.list
27-
sudo dpkg --add-architecture armhf
24+
sudo sed -i '/^$/d;/^#/d;s/deb/deb [arch=amd64]/g' /etc/apt/sources.list.d/main.list
25+
sudo cp /etc/apt/sources.list.d/main.list /etc/apt/sources.list.d/port.list
26+
sudo sed -i 's/arch=amd64/arch=arm64,armhf,ppc64el,riscv64,s390x/g;s/archive/ports/g;s/security\./security.ports./g;s/\/ubuntu/\/ubuntu-ports/g' /etc/apt/sources.list.d/port.list
2827
sudo dpkg --add-architecture arm64
28+
sudo dpkg --add-architecture armhf
29+
sudo dpkg --add-architecture ppc64el
30+
sudo dpkg --add-architecture riscv64
31+
sudo dpkg --add-architecture s390x
2932
sudo apt update
30-
sudo apt install -y libcjson-dev:amd64 libcjson-dev:armhf libcjson-dev:arm64
31-
- name: Build artifacts
33+
sudo apt install -y libcjson-dev:amd64 libcjson-dev:arm64 libcjson-dev:armhf libcjson-dev:ppc64el libcjson-dev:riscv64 libcjson-dev:s390x
34+
- name: Build amd64
35+
run: |
36+
mkdir build-amd64
37+
cd build-amd64
38+
cmake -DCMAKE_C_COMPILER=`which gcc` -DEXEC_SUFFIX="-amd64" ..
39+
make
40+
cd ..
41+
- name: Build arm64
42+
run: |
43+
mkdir build-arm64
44+
cd build-arm64
45+
cmake -DCMAKE_C_COMPILER=`which aarch64-linux-gnu-gcc` -DEXEC_SUFFIX="-arm64" ..
46+
make
47+
cd ..
48+
- name: Build armhf
49+
run: |
50+
mkdir build-armhf
51+
cd build-armhf
52+
cmake -DCMAKE_C_COMPILER=`which arm-linux-gnueabihf-gcc` -DEXEC_SUFFIX="-armhf" ..
53+
make
54+
cd ..
55+
- name: Build ppc64el
56+
run: |
57+
mkdir build-ppc64el
58+
cd build-ppc64el
59+
cmake -DCMAKE_C_COMPILER=`which powerpc64le-linux-gnu-gcc` -DEXEC_SUFFIX="-ppc64el" ..
60+
make
61+
cd ..
62+
- name: Build riscv64
63+
run: |
64+
mkdir build-riscv64
65+
cd build-riscv64
66+
cmake -DCMAKE_C_COMPILER=`which riscv64-linux-gnu-gcc` -DEXEC_SUFFIX="-riscv64" ..
67+
make
68+
cd ..
69+
- name: Build s390x
70+
run: |
71+
mkdir build-s390x
72+
cd build-s390x
73+
cmake -DCMAKE_C_COMPILER=`which s390x-linux-gnu-gcc` -DEXEC_SUFFIX="-s390x" ..
74+
make
75+
cd ..
76+
- name: Post build
3277
run: |
3378
mkdir build
34-
gcc -o build/mcrelay-amd64 mcrelay.c -lresolv -lcjson
35-
arm-linux-gnueabihf-gcc -o build/mcrelay-armhf mcrelay.c -lresolv -lcjson
36-
aarch64-linux-gnu-gcc -o build/mcrelay-arm64 mcrelay.c -lresolv -lcjson
79+
cd build
80+
cp ../build-amd64/mcrelay-amd64 .
81+
cp ../build-arm64/mcrelay-arm64 .
82+
cp ../build-armhf/mcrelay-armhf .
83+
cp ../build-ppc64el/mcrelay-ppc64el .
84+
cp ../build-riscv64/mcrelay-riscv64 .
85+
cp ../build-s390x/mcrelay-s390x .
3786
- name: Upload artifacts
3887
uses: AButler/upload-release-assets@v2.0
3988
with:

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build
2+
build-*

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
cmake_minimum_required(VERSION 3.0)
2+
project(mcrelay${EXEC_SUFFIX}
3+
VERSION 1.2
4+
LANGUAGES C)
5+
add_executable(mcrelay${EXEC_SUFFIX} src/basic.c src/config.c src/log.c src/main.c src/misc.c src/network.c src/protocols/common.c src/protocols/handshake.c src/protocols/handshake_legacy.c src/protocols/proxy.c)
6+
target_link_libraries(mcrelay${EXEC_SUFFIX} -lresolv -lcjson)

Makefile

Lines changed: 0 additions & 2 deletions
This file was deleted.

README.md

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# mcrelay
2-
Minecraft Relay Server
1+
# Minecraft Relay Server (mcrelay)
32

43
A minecraft reverse proxy server with server address rewrite.
54

@@ -14,8 +13,8 @@ Minecraft Versions before 12w04a are **NOT SUPPORTED**!
1413

1514
## Requirements
1615
* Linux
17-
* libresolv.so
18-
* libcjson.so
16+
* libresolv.so (usually pre-installed)
17+
* libcjson.so (on debian-like systems, contained in package "libcjson1")
1918

2019
## Compatibility
2120
**Due to Minecraft Handshake restrictions, this server supports:**
@@ -24,22 +23,30 @@ Minecraft Versions before 12w04a are **NOT SUPPORTED**!
2423
* MOTD relay / MOTD status notice on server & client with version 1.6.1 and later, except version 13w41a and 13w41b.
2524

2625
## Files
27-
* mcrelay.c: Source code of Main program.
28-
* config.json.example: config file example.
29-
* mcrelay.service.forking.example: service unit file of mcrelay for systemd. (using runmode: forking)
30-
* mcrelay.service.simple.example: service unit file of mcrelay for systemd. (using runmode: simple)
31-
* mod: directory of essential modules.
32-
* version.json: version manifest.
33-
* loglevel.info: definations for messages.
26+
* CMakeLists.txt: CMake configuration for compiling
27+
* doc: Folder of documents
28+
* doc/loglevel.info: Definations of log levels
29+
* doc/versions.json: Version manifest
30+
* examples: File templates
31+
* examples/config: Folder of example configurations
32+
* examples/systemd: Folder of example systemd service files
33+
* src: Folder of source codes
3434

3535
## Compile
36+
Before compiling, you need to install cJSON at first.
37+
38+
For example, you can install it on a debian-like systems by <code>apt install libcjson-dev</code>.
39+
40+
Then you can use CMake to compile it, by following:
3641
<pre>
37-
gcc -o mcrelay mcrelay.c -lresolv -lcjson
38-
</pre>
39-
or
40-
<pre>
42+
mkdir build
43+
cd build
44+
cmake ..
4145
make
4246
</pre>
47+
Additionally, if you want cross compiling, following CMake properties will helpful:
48+
* <code>-DCMAKE_C_COMPILER</code>: Specify an alternative compiler, CMake using <code>cc</code> by default.
49+
* <code>-DEXEC_SUFFIX</code>: Add a suffix to the final binary file, the file will generated called <code>mcrelay</code>.
4350

4451
## Usage
4552
<pre>
@@ -51,7 +58,7 @@ The program will run as a non-exit-style program by default.
5158
When using "-f" or "--forking" option, the program will become daemonized, and store its main process' PID into /tmp/mcrelay.pid.
5259

5360
## Config
54-
See "config.json.example" for instructions.
61+
See "examples/config/config.json" for instructions.
5562

5663
## Instruction of using a DNS-based redirection (SRV)
5764
If you are using a SRV record to provide your service, you should follow the instructions below.
File renamed without changes.

version.json renamed to doc/versions.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,5 +210,45 @@
210210
{
211211
"version": 55,
212212
"names": ["1.2-beta2-patch13","1.2-beta2"]
213+
},
214+
{
215+
"version": 56,
216+
"names": ["1.2-beta3-patch1"]
217+
},
218+
{
219+
"version": 57,
220+
"names": ["1.2-beta3-patch2","1.2-beta3-patch3"]
221+
},
222+
{
223+
"version": 58,
224+
"names": ["1.2-beta3-patch4"]
225+
},
226+
{
227+
"version": 59,
228+
"names": ["1.2-beta3-patch5"]
229+
},
230+
{
231+
"version": 60,
232+
"names": ["1.2-beta3-patch6"]
233+
},
234+
{
235+
"version": 61,
236+
"names": ["1.2-beta3-patch7"]
237+
},
238+
{
239+
"version": 62,
240+
"names": ["1.2-beta3-patch8"]
241+
},
242+
{
243+
"version": 63,
244+
"names": ["1.2-beta3-patch9"]
245+
},
246+
{
247+
"version": 64,
248+
"names": ["1.2-beta3-patch10"]
249+
},
250+
{
251+
"version": 65,
252+
"names": ["1.2-beta3-patch11","1.2-beta3"]
213253
}
214254
]
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ User=nobody
88
Group=nogroup
99
Restart=on-failure
1010
RestartSec=5s
11-
PID=/tmp/mcrelay.pid
12-
ExecStart=/usr/bin/mcrelay -f /etc/mcrelay/mcrelay.conf
11+
PIDFile=/tmp/mcrelay.pid
12+
ExecStart=/usr/bin/mcrelay -f /etc/mcrelay/config.json
1313
ExecStop=/usr/bin/mcrelay -t
1414
ExecReload=/usr/bin/mcrelay -r
1515

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ User=nobody
88
Group=nogroup
99
Restart=on-failure
1010
RestartSec=5s
11-
ExecStart=/usr/bin/mcrelay /etc/mcrelay/mcrelay.conf
11+
ExecStart=/usr/bin/mcrelay /etc/mcrelay/config.json
1212
ExecStop=/usr/bin/mcrelay -t
1313
ExecReload=/usr/bin/mcrelay -r
1414

0 commit comments

Comments
 (0)