Skip to content

Commit

Permalink
Merge pull request #3 from bilintsui/dev-1.1-beta3
Browse files Browse the repository at this point in the history
v1.1(development beta 3)
  • Loading branch information
bilintsui authored Nov 10, 2020
2 parents 5f09f36 + b952b0b commit dd44d36
Show file tree
Hide file tree
Showing 12 changed files with 881 additions and 285 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
mcrelay:
gcc -o mcrelay mcrelay.c
gcc -o mcrelay mcrelay.c -lresolv
29 changes: 21 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Minecraft Versions before 12w04a are **NOT SUPPORTED**!<br/>

## Requirements
* Linux
* libresolv.so

## Compatibility
**Due to Minecraft Handshake restrictions, this server supports:**<br/>
Expand All @@ -20,12 +21,14 @@ Minecraft Versions before 12w04a are **NOT SUPPORTED**!<br/>
## Files
* mcrelay.c: Source code of Main program.
* mcrelay.conf.example: config file example of mcrelay.
* mcrelay.service.example: service unit file of mcrelay for systemd.
* mcrelay.service.forking.example: service unit file of mcrelay for systemd(using runmode: forking).
* mcrelay.service.simple.example: service unit file of mcrelay for systemd(using runmode: simple).
* mod/*.h: header files of essential modules.
* loglevel.info: definations for messages.

## Compile
<pre>
gcc -o mcrelay mcrelay.c
gcc -o mcrelay mcrelay.c -lresolv
</pre>
or
<pre>
Expand All @@ -40,30 +43,40 @@ mcrelay config_file
## Config
### Format
<pre>
runmode run_mode
log logfile_path
loglevel loglvl
bind bind_object
proxy_pass proxy_type
ident_name destination_object
proxy_pass proxy_type
ident_name destination_object
</pre>
### Explanation
* runmode: set program's runmode.
>* run_mode: type of program's runmode, "simple" for a normal, non-exit program, "forking" for a daemonized program. In forking, it will store the PID in /tmp/mcrelay.pid.
* log: set log file.
>* logfile_path: path of the file which logs saved to.
* loglevel: set max message level in logging message.
>* loglvl: a unsigned short integer, range 0-255. This program will not log message with level higher than this level. 0: Critical, 1: Warning, 2+: Information. For more information, watch loglevel.info.
* bind: set bind information.
>* bind_object: (format: "address:port" or "unix:path") default: "0.0.0.0:25565".
>>* address: the address you wish to bind as an Internet Service. Only x.x.x.x allowed.
>>* port: the address you wish to bind as an Internet Service. Valid range: 1-65535.
>>* port: the port you wish to bind as an Internet Service. Valid range: 1-65535.
>>* path: the socket file you wish to bind as an UNIX Socket.
* proxy_pass: list of relay/relay+rewrites.
>* proxy_type: type of proxies, "relay" for raw relay, "rewrite" for relay with server address camouflage enabled.
>* ident_name: name of destination identification. Usually a Fully Qualified Domain Name(FQDN) by CNAME to your server.
>* destination_object: (format: "address_d:port" or "unix:path")
>>* address_d: the address you wish to bind as an Internet Service. Both FQDN or x.x.x.x allowed.
>>* port: the address you wish to bind as an Internet Service. Valid range: 1-65535.
>>* path: the socket file you wish to bind as an UNIX Socket.
>* destination_object: (format: "address_d[:port]" or "unix:path")
>>* address_d: the address you wish to connect. Both FQDN or x.x.x.x allowed.
>>* port: optional, the port you wish to connect. Valid range: 1-65535.<br/>
If not set, the server will detect SRV record first(defined in address_d).<br/>
If SRV record resolve failed, it will fallback to normal address resolve, also connect to this address with port 25565.<br/>
**For rewrite enabled relay, it will use actual connect configuration to rewrite.**
>>* path: the socket file you wish to connect.
### Example
<pre>
runmode forking
log /var/log/mcrelay/mcrelay.log
bind 0.0.0.0:25565
proxy_pass rewrite
Expand All @@ -72,4 +85,4 @@ proxy_pass rewrite
proxy_pass relay
mc1.example.com 127.0.0.1:25566
mc2.example.com 192.168.1.254:25565
</pre>
</pre>
7 changes: 7 additions & 0 deletions loglevel.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# LOG LEVEL DEFINATION for v1.1, beta 3, patch 4.
# Log level mentioned here had already defined in the program, if new message type defined, this file will be changed
Level Type Description
0 Critical When a non-ignorable error occurs, program will output this message to STDERR.
1 Warning When an ignorable error occurs, program will output this message to STDOUT.
2 Information, rate 0 Normal information. eg: Incoming login request.
3 Information, rate 1 Normal information, but annoying. eg: Incoming MOTD request.
Loading

0 comments on commit dd44d36

Please sign in to comment.