From 674215d0cc3381ff35377e3ee07bf1092b023252 Mon Sep 17 00:00:00 2001 From: sneak Date: Tue, 25 Feb 2020 07:51:22 -0800 Subject: [PATCH] updated to new names/urls --- .gitignore | 2 +- Makefile | 21 ++++++++++++--------- main.go => cmd/sircd/main.go | 6 ++---- {sircd => irc}/client.go | 4 ++-- {sircd => irc}/irc.go | 2 +- {sircd => irc}/message.go | 2 +- {sircd => irc}/responses.go | 14 +++++++------- {sircd => irc}/server.go | 2 +- {sircd => irc}/session.go | 2 +- 9 files changed, 28 insertions(+), 27 deletions(-) rename main.go => cmd/sircd/main.go (93%) rename {sircd => irc}/client.go (98%) rename {sircd => irc}/irc.go (99%) rename {sircd => irc}/message.go (98%) rename {sircd => irc}/responses.go (96%) rename {sircd => irc}/server.go (99%) rename {sircd => irc}/session.go (99%) diff --git a/.gitignore b/.gitignore index 6c98d72..ff87a2b 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -/ircd +/sircd diff --git a/Makefile b/Makefile index 661696d..5d67dad 100644 --- a/Makefile +++ b/Makefile @@ -1,28 +1,31 @@ VERSION := $(shell git rev-parse --short HEAD) -BUILDTIME := $(shell date -u '+%Y-%m-%dT%H:%M:%SZ') BUILDUSER := $(shell whoami) BUILDHOST := $(shell hostname -s) BUILDARCH := $(shell uname -m) GOLDFLAGS += -X main.Version=$(VERSION) -GOLDFLAGS += -X main.Buildtime=$(BUILDTIME) GOLDFLAGS += -X main.Builduser=$(BUILDUSER)@$(BUILDHOST) GOLDFLAGS += -X main.Buildarch=$(BUILDARCH) GOFLAGS = -ldflags "$(GOLDFLAGS)" +FN := sircd + default: rundebug rundebug: build - DEBUG=1 ./ircd + DEBUG=1 ./$(FN) run: build - ./ircd + ./$(FN) -build: ./ircd +build: $(FN) -./ircd: *.go */*.go - go build -o $@ $(GOFLAGS) . +go-get: + cd cmd/$(FN) && go get -v + +./$(FN): */*.go cmd/*/*.go go-get + cd cmd/$(FN) && go build -o ../../$(FN) $(GOFLAGS) . fmt: - go fmt *.go - go fmt sircd/*.go + go fmt */*.go + go fmt cmd/$(FN)/*.go diff --git a/main.go b/cmd/sircd/main.go similarity index 93% rename from main.go rename to cmd/sircd/main.go index 26b34b4..eaae14e 100644 --- a/main.go +++ b/cmd/sircd/main.go @@ -3,11 +3,10 @@ package main import "os" import "fmt" import "github.com/sirupsen/logrus" -import "github.com/sneak/sircd/sircd" +import "git.eeqj.de/sneak/sircd/irc" import "github.com/spf13/viper" var Version string -var Buildtime string var Builduser string var Buildarch string @@ -20,7 +19,6 @@ func main() { c.SetDefault("admin", "webmaster@example.com") c.SetDefault("loglevel", "info") c.SetDefault("version", Version) - c.SetDefault("buildtime", Buildtime) c.SetDefault("builduser", Builduser) c.SetDefault("buildarch", Buildarch) @@ -53,7 +51,7 @@ func main() { log.SetReportCaller(true) } // instantiate server - s := sircd.New(c) + s := irc.New(c) // give it our logger s.SetLogger(log) diff --git a/sircd/client.go b/irc/client.go similarity index 98% rename from sircd/client.go rename to irc/client.go index 61edf13..de4f9df 100644 --- a/sircd/client.go +++ b/irc/client.go @@ -1,4 +1,4 @@ -package sircd +package irc import ( "bytes" @@ -110,7 +110,7 @@ func (c *ircClient) SendServerMessage(code uint16, params []string) bool { } } - sendstr := fmt.Sprintf(":%s %s %d", c.ServerName(), code, c.session.nick) + sendstr := fmt.Sprintf(":%s %d %s", c.ServerName(), code, c.session.nick) if len(p) > 0 { sendstr = sendstr + " " + p } diff --git a/sircd/irc.go b/irc/irc.go similarity index 99% rename from sircd/irc.go rename to irc/irc.go index 78ee45e..febbefb 100644 --- a/sircd/irc.go +++ b/irc/irc.go @@ -1,4 +1,4 @@ -package sircd +package irc func (s *ircd) processIRCMessage(m *ircMessage) { // FIXME put all of these in a map of string->function diff --git a/sircd/message.go b/irc/message.go similarity index 98% rename from sircd/message.go rename to irc/message.go index fcd8f94..556846e 100644 --- a/sircd/message.go +++ b/irc/message.go @@ -1,4 +1,4 @@ -package sircd +package irc import ( "errors" diff --git a/sircd/responses.go b/irc/responses.go similarity index 96% rename from sircd/responses.go rename to irc/responses.go index 017ecbd..6df9b6b 100644 --- a/sircd/responses.go +++ b/irc/responses.go @@ -1,4 +1,4 @@ -package sircd +package irc import log "github.com/sirupsen/logrus" @@ -6,15 +6,15 @@ type ircServerResponse struct { code uint16 symbol string longtext string - params *[]string + params *[]string } func NewIrcServerResponse(code uint16, params *[]string) { - codes := ircResponseCodes() - r := new(ircServerResponse) - r.code = code - r.symbol = (*codes)[code] - r.params = params + codes := ircResponseCodes() + r := new(ircServerResponse) + r.code = code + r.symbol = (*codes)[code] + r.params = params } func ircResponseCodes() *map[uint16]string { diff --git a/sircd/server.go b/irc/server.go similarity index 99% rename from sircd/server.go rename to irc/server.go index 495963e..35a6bdf 100644 --- a/sircd/server.go +++ b/irc/server.go @@ -1,4 +1,4 @@ -package sircd +package irc import "github.com/sirupsen/logrus" import "github.com/spf13/viper" diff --git a/sircd/session.go b/irc/session.go similarity index 99% rename from sircd/session.go rename to irc/session.go index ea7ac4b..2710e12 100644 --- a/sircd/session.go +++ b/irc/session.go @@ -1,4 +1,4 @@ -package sircd +package irc import log "github.com/sirupsen/logrus"