Add some missing stuff

This commit is contained in:
Andreas Neue 2021-05-19 11:28:32 +02:00
parent 623a69d025
commit cfb4daaf1e
6 changed files with 93 additions and 3 deletions

12
Dockerfile Normal file
View File

@ -0,0 +1,12 @@
FROM golang:latest
MAINTAINER Andreas Neue <an@dnix.de>
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"]

40
Makefile Normal file
View File

@ -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@<server>:/ircd

View File

@ -1,2 +1,3 @@
# verbiage
# ircd
don't read me please

View File

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

31
ircd.go Normal file
View File

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

7
version.go Normal file
View File

@ -0,0 +1,7 @@
package main
const (
Version = "dev"
Build = "0"
Builddate = "unknown"
)