commit 6340f90a419853f00718d55e0b252e865bfe5e2f Author: fanyx Date: Fri Apr 2 18:53:25 2021 +0200 init commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..d4336c2 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# goufy + +A modern server manager for Trackmania United Forever. + +### Why + +Because writing a modern server manager for a decade old game is pretty goufy. + +Name is derived from Go(lang) and United Forever \ No newline at end of file diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..7cedc34 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module git.fanyx.xyz/fanyx/goufy + +go 1.14 + +require gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..97f8991 --- /dev/null +++ b/go.sum @@ -0,0 +1,3 @@ +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/main.go b/main.go new file mode 100644 index 0000000..ce9de48 --- /dev/null +++ b/main.go @@ -0,0 +1,18 @@ +package main + +import ( + "fmt" + "log" + + . "git.fanyx.xyz/fanyx/goufy" +) + +func main() { + config, err := readConfig() + if err != nil { + log.Fatal(err) + } + + fmt.Printf("#%v", config) + +} diff --git a/pkg/config/config.go b/pkg/config/config.go new file mode 100644 index 0000000..0bdcc7f --- /dev/null +++ b/pkg/config/config.go @@ -0,0 +1,27 @@ +package config + +import ( + "io/ioutil" + + yaml "gopkg.in/yaml.v3" +) + +const CONFIGFILE = "config.yaml" + +type Config struct { + host string `yaml:"host"` + port int `yaml:"port"` +} + +func (c *Config) readConfig() (*Config, error) { + yamlFile, err := ioutil.ReadFile(CONFIGFILE) + if err != nil { + return nil, err + } + err = yaml.Unmarshal([]byte(yamlFile), c) + if err != nil { + return nil, err + } + + return c, nil +} diff --git a/pkg/connection/connection.go b/pkg/connection/connection.go new file mode 100644 index 0000000..d7feddb --- /dev/null +++ b/pkg/connection/connection.go @@ -0,0 +1,12 @@ +package connection + +import "net" + +func connect() { + var gbxConnString string + conn, err := net.Dial("tcp", gbxConnString) + if err != nil { + panic(err) + } + defer conn.Close() +}