init commit

This commit is contained in:
fanyx 2021-04-02 18:53:25 +02:00
commit 6340f90a41
6 changed files with 74 additions and 0 deletions

9
README.md Normal file
View File

@ -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

5
go.mod Normal file
View File

@ -0,0 +1,5 @@
module git.fanyx.xyz/fanyx/goufy
go 1.14
require gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b

3
go.sum Normal file
View File

@ -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=

18
main.go Normal file
View File

@ -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)
}

27
pkg/config/config.go Normal file
View File

@ -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
}

View File

@ -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()
}