From bfb7961229b7c45304da725cc5146839e0977f9c Mon Sep 17 00:00:00 2001 From: Timothy Date: Mon, 30 Oct 2017 14:17:18 +0800 Subject: [PATCH] move Makefile, add program logo --- Makefile => cmd/godns/Makefile | 10 +++++----- cmd/godns/godns.go | 3 +++ utils.go | 16 ++++++++++++++++ 3 files changed, 24 insertions(+), 5 deletions(-) rename Makefile => cmd/godns/Makefile (58%) diff --git a/Makefile b/cmd/godns/Makefile similarity index 58% rename from Makefile rename to cmd/godns/Makefile index 2bc942d..8da0984 100644 --- a/Makefile +++ b/cmd/godns/Makefile @@ -2,7 +2,7 @@ BINARY=godns # Builds the project build: - go build -o ${BINARY} + go build -o ${BINARY} -ldflags "-X main.Version=${VERSION}" # Installs our project: copies binaries install: go install @@ -11,19 +11,19 @@ release: go clean rm -rf *.gz # Build for mac - go build + go build -o ${BINARY} -ldflags "-X main.Version=${VERSION}" tar czvf ${BINARY}-mac64-${VERSION}.tar.gz ./${BINARY} # Build for linux go clean - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ${BINARY} -ldflags "-X main.Version=${VERSION}" tar czvf ${BINARY}-linux64-${VERSION}.tar.gz ./${BINARY} # Build for arm go clean - CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build + CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -o ${BINARY} -ldflags "-X main.Version=${VERSION}" tar czvf ${BINARY}-arm64-${VERSION}.tar.gz ./${BINARY} # Build for win go clean - CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build + CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o ${BINARY} -ldflags "-X main.Version=${VERSION}" tar czvf ${BINARY}-win64-${VERSION}.tar.gz ./${BINARY}.exe go clean # Cleans our projects: deletes binaries diff --git a/cmd/godns/godns.go b/cmd/godns/godns.go index 51a59b9..2cb5b77 100644 --- a/cmd/godns/godns.go +++ b/cmd/godns/godns.go @@ -9,17 +9,20 @@ import ( "github.com/TimothyYe/godns" "github.com/TimothyYe/godns/handler" + "github.com/fatih/color" ) var ( configuration godns.Settings optConf = flag.String("c", "./config.json", "Specify a config file") optHelp = flag.Bool("h", false, "Show help") + Version = "0.1" ) func main() { flag.Parse() if *optHelp { + color.Cyan(godns.Logo, Version) flag.Usage() return } diff --git a/utils.go b/utils.go index f85c64c..908db3f 100644 --- a/utils.go +++ b/utils.go @@ -11,6 +11,22 @@ import ( "golang.org/x/net/proxy" ) +var ( + Logo = ` + + ██████╗ ██████╗ ██████╗ ███╗ ██╗███████╗ +██╔════╝ ██╔═══██╗██╔══██╗████╗ ██║██╔════╝ +██║ ███╗██║ ██║██║ ██║██╔██╗ ██║███████╗ +██║ ██║██║ ██║██║ ██║██║╚██╗██║╚════██║ +╚██████╔╝╚██████╔╝██████╔╝██║ ╚████║███████║ + ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝ + +GoDNS V%s +https://github.com/TimothyYe/godns + +` +) + const ( // PanicMax is the max allowed panic times PanicMax = 5