more fmt
parent
79e6aaacde
commit
d4868fa178
|
@ -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
|
||||||
|
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/yuin/gopher-lua"
|
"github.com/yuin/gopher-lua"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
1
l_log.go
1
l_log.go
|
@ -2,7 +2,6 @@ package multiserver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/yuin/gopher-lua"
|
"github.com/yuin/gopher-lua"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package multiserver
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/yuin/gopher-lua"
|
"github.com/yuin/gopher-lua"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package multiserver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/yuin/gopher-lua"
|
"github.com/yuin/gopher-lua"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package multiserver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/yuin/gopher-lua"
|
"github.com/yuin/gopher-lua"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package multiserver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/yuin/gopher-lua"
|
"github.com/yuin/gopher-lua"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
3
peer.go
3
peer.go
|
@ -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 }
|
||||||
|
|
Loading…
Reference in New Issue