diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..f483e46 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +FROM golang:latest +MAINTAINER Andreas Neue + +RUN apt -y update && apt -y upgrade && apt-get install -y fortune vim tzdata ca-certificates && apt-get clean +RUN ln -fs /usr/share/zoneinfo/Europe/Berlin /etc/localtime && dpkg-reconfigure -f noninteractive tzdata + +WORKDIR /go/src/ircd +COPY . . +RUN go get -d -v ./... +RUN go install -v ./... + +CMD ["ircd", "-conf", "/go/src/ircd/conf/server.conf"] diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ea8db2e --- /dev/null +++ b/Makefile @@ -0,0 +1,40 @@ +GOPATH := ${PWD}:${GOPATH} +export GOPATH + +default: build + +build: genversion test + go build -v + +build-win: test genversion + GOOS=windows GOARCH=amd64 go build -v -o ircd.exe ircd + +genversion: + ./genversion.sh + +fmt: + go fmt ./... + +fix: + go fix ./... + +imports: + find . -type f -name "*.go" -exec goimports -w {} \; + +doc: + godoc -http=:6060 -index + +test: + go test ./... + +commit: + git commit -a -F changes.log + rm changes.log + touch changes.log + ./genversion.sh + +push: + git push + +deploy: + scp -r * root@:/ircd diff --git a/README.md b/README.md index c2ac251..bd8a470 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ -# verbiage +# ircd +don't read me please diff --git a/irc/server.go b/irc/server.go index 178b9e1..f05616f 100644 --- a/irc/server.go +++ b/irc/server.go @@ -44,7 +44,6 @@ type Server struct { opers map[string]string clients map[string]Client - clModes map[string]string clHosts map[string]string services map[string]*Service @@ -75,7 +74,7 @@ func NewServer(configPath, software, version string) *Server { sv.opers = make(map[string]string) sv.clients = make(map[string]Client) - sv.clModes = make(map[string]string) + /*sv.clModes = make(map[string]string)*/ sv.clHosts = make(map[string]string) sv.services = make(map[string]*Service, 0) diff --git a/ircd.go b/ircd.go new file mode 100644 index 0000000..2c57e73 --- /dev/null +++ b/ircd.go @@ -0,0 +1,31 @@ +// vim:ts=4:sts=4:sw=4:noet:tw=72 + +package main + +import ( + "flag" + "fmt" + "runtime" + + "git.dnix.de/an/ircd/irc" +) + +var configFile = flag.String("conf", "server.conf", "Config file") + +func init() { + flag.Parse() +} + +func main() { + sv := irc.NewServer(*configFile, "verbiage", ircdInfo()) + sv.SetAuthCallback(authenticate) + sv.Run() +} + +func authenticate(name, password string) (string, bool) { + return "irc/user", true +} + +func ircdInfo() string { + return fmt.Sprintf("%s-%s (built %s [%s])", Version, Build, Builddate, runtime.Version()) +} diff --git a/version.go b/version.go new file mode 100644 index 0000000..8275d6b --- /dev/null +++ b/version.go @@ -0,0 +1,7 @@ +package main + +const ( + Version = "dev" + Build = "0" + Builddate = "unknown" +)