Browse Source

Add default value for host

master
HimbeerserverDE 1 year ago
parent
commit
d2993c4401
No known key found for this signature in database
GPG Key ID: 1A651504791E6A8B
  1. 4
      README.md
  2. 3
      config.go
  3. 2
      multiserver.go
  4. 9
      serverlist.go

4
README.md

@ -28,7 +28,6 @@ The configuration file is located in `WORKING_DIR/config/multiserver.yml`
- Default config file
```yml
host: "0.0.0.0:33000"
servers:
lobby:
address: "127.0.0.1:30000"
@ -39,7 +38,8 @@ force_default_server: true
> `host`
```
Type: String
Description: The IP address and port the proxy will be running on
Description: The IP address and port the proxy will be running on,
default is 0.0.0.0:33000
```
> `player_limit`
```

3
config.go

@ -9,8 +9,7 @@ import (
var config map[interface{}]interface{}
var defaultConfig []byte = []byte(`host: "0.0.0.0:33000"
servers:
var defaultConfig []byte = []byte(`servers:
lobby:
address: "127.0.0.1:30000"
default_server: lobby

2
multiserver.go

@ -25,7 +25,7 @@ func main() {
host, ok := ConfKey("host").(string)
if !ok {
log.Fatal("Host not set or not a string")
host = "0.0.0.0:33000"
}
lc, err := net.ListenPacket("udp", host)

9
serverlist.go

@ -25,7 +25,10 @@ func Announce(action string) error {
log.Print("Updating server list announcement")
host := ConfKey("host").(string)
host, ok := ConfKey("host").(string)
if !ok {
host = "0.0.0.0:33000"
}
addr, err := net.ResolveUDPAddr("udp", host)
if err != nil {
@ -74,8 +77,8 @@ func Announce(action string) error {
data["name"] = conf("serverlist_name")
data["description"] = conf("serverlist_desc")
data["version"] = "multiserver v1.9.2"
data["proto_min"] = 37
data["proto_max"] = 39
data["proto_min"] = ProtoMin
data["proto_max"] = ProtoLatest
data["url"] = conf("serverlist_display_url")
data["creative"] = confBool("serverlist_creative")
data["damage"] = confBool("serverlist_damage")

Loading…
Cancel
Save