master
HimbeerserverDE 2021-01-10 11:02:51 +01:00
parent 79e6aaacde
commit d4868fa178
10 changed files with 6 additions and 17 deletions

View File

@ -7,7 +7,7 @@ import (
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
) )
var Config map[interface{}]interface{} var config map[interface{}]interface{}
var defaultConfig []byte = []byte(`host: "0.0.0.0:33000" var defaultConfig []byte = []byte(`host: "0.0.0.0:33000"
player_limit: -1 player_limit: -1
@ -30,9 +30,9 @@ func LoadConfig() error {
return err return err
} }
Config = make(map[interface{}]interface{}) config = make(map[interface{}]interface{})
err = yaml.Unmarshal(data, &Config) err = yaml.Unmarshal(data, &config)
if err != nil { if err != nil {
return err return err
} }
@ -43,7 +43,7 @@ func LoadConfig() error {
// GetKey returns a key in the configuration // GetKey returns a key in the configuration
func GetConfKey(key string) interface{} { func GetConfKey(key string) interface{} {
keys := strings.Split(key, ":") keys := strings.Split(key, ":")
c := Config c := config
for i := 0; i < len(keys)-1; i++ { for i := 0; i < len(keys)-1; i++ {
if c[keys[i]] == nil { if c[keys[i]] == nil {
return nil return nil

View File

@ -5,7 +5,6 @@ import (
"log" "log"
"strings" "strings"
"time" "time"
"github.com/yuin/gopher-lua" "github.com/yuin/gopher-lua"
) )

View File

@ -1,8 +1,6 @@
package multiserver package multiserver
import ( import "github.com/yuin/gopher-lua"
"github.com/yuin/gopher-lua"
)
func luaGetConfKey(L *lua.LState) int { func luaGetConfKey(L *lua.LState) int {
key := L.ToString(1) key := L.ToString(1)

View File

@ -2,7 +2,6 @@ package multiserver
import ( import (
"log" "log"
"github.com/yuin/gopher-lua" "github.com/yuin/gopher-lua"
) )

View File

@ -3,7 +3,6 @@ package multiserver
import ( import (
"encoding/binary" "encoding/binary"
"log" "log"
"github.com/yuin/gopher-lua" "github.com/yuin/gopher-lua"
) )

View File

@ -2,7 +2,6 @@ package multiserver
import ( import (
"log" "log"
"github.com/yuin/gopher-lua" "github.com/yuin/gopher-lua"
) )

View File

@ -2,7 +2,6 @@ package multiserver
import ( import (
"log" "log"
"github.com/yuin/gopher-lua" "github.com/yuin/gopher-lua"
) )

View File

@ -2,7 +2,6 @@ package multiserver
import ( import (
"strings" "strings"
"github.com/yuin/gopher-lua" "github.com/yuin/gopher-lua"
) )

View File

@ -115,9 +115,6 @@ func (p *Peer) Forward() bool { return p.forward }
// StopForwarding tells the Proxy func to stop // StopForwarding tells the Proxy func to stop
func (p *Peer) StopForwarding() { p.forward = false } func (p *Peer) StopForwarding() { p.forward = false }
// StartForwarding makes forwarding possible again
func (p *Peer) StartForwarding() { p.forward = true }
// Server returns the Peer this Peer is connected to // Server returns the Peer this Peer is connected to
// if this Peer is not a server // if this Peer is not a server
func (p *Peer) Server() *Peer { return p.srv } func (p *Peer) Server() *Peer { return p.srv }

View File

@ -2,8 +2,8 @@ package multiserver
import ( import (
"database/sql" "database/sql"
_ "github.com/mattn/go-sqlite3"
"strings" "strings"
_ "github.com/mattn/go-sqlite3"
) )
// encodePrivs encodes priv map into DB-ready string // encodePrivs encodes priv map into DB-ready string