Skip to content

Commit 5fcbeb6

Browse files
committed
feat: go mod supported
1 parent 25e7179 commit 5fcbeb6

File tree

302 files changed

+237
-62683
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

302 files changed

+237
-62683
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
.idea
1+
.idea
2+
nps
3+
npc

Makefile

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
SOURCE_FILES?=./...
2+
TEST_PATTERN?=.
3+
TEST_OPTIONS?=
4+
5+
export PATH := ./bin:$(PATH)
6+
export GO111MODULE := on
7+
export GOPROXY := https://gocenter.io
8+
9+
# Build a beta version of goreleaser
10+
build:
11+
go build cmd/nps/nps.go
12+
go build cmd/npc/npc.go
13+
.PHONY: build
14+
15+
# Install all the build and lint dependencies
16+
setup:
17+
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh
18+
curl -L https://git.io/misspell | sh
19+
go mod download
20+
.PHONY: setup
21+
22+
# Run all the tests
23+
test:
24+
go test $(TEST_OPTIONS) -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt $(SOURCE_FILES) -run $(TEST_PATTERN) -timeout=2m
25+
.PHONY: test
26+
27+
# Run all the tests and opens the coverage report
28+
cover: test
29+
go tool cover -html=coverage.txt
30+
.PHONY: cover
31+
32+
# gofmt and goimports all go files
33+
fmt:
34+
find . -name '*.go' -not -wholename './vendor/*' | while read -r file; do gofmt -w -s "$$file"; goimports -w "$$file"; done
35+
.PHONY: fmt
36+
37+
# Run all the linters
38+
lint:
39+
# TODO: fix tests and lll issues
40+
./bin/golangci-lint run --tests=false --enable-all --disable=lll ./...
41+
./bin/misspell -error **/*
42+
.PHONY: lint
43+
44+
# Clean go.mod
45+
go-mod-tidy:
46+
@go mod tidy -v
47+
@git diff HEAD
48+
@git diff-index --quiet HEAD
49+
.PHONY: go-mod-tidy
50+
51+
# Run all the tests and code checks
52+
ci: build test lint go-mod-tidy
53+
.PHONY: ci
54+
55+
# Generate the static documentation
56+
static:
57+
@hugo --enableGitInfo --source www
58+
.PHONY: static
59+
60+
# Show to-do items per file.
61+
todo:
62+
@grep \
63+
--exclude-dir=vendor \
64+
--exclude-dir=node_modules \
65+
--exclude=Makefile \
66+
--text \
67+
--color \
68+
-nRo -E ' TODO:.*|SkipNow' .
69+
.PHONY: todo
70+
71+
clean:
72+
rm npc nps
73+
.PHONY: clean
74+
75+
.DEFAULT_GOAL := build

bridge/bridge.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
"github.com/cnlh/nps/lib/version"
1313
"github.com/cnlh/nps/server/connection"
1414
"github.com/cnlh/nps/server/tool"
15-
"github.com/cnlh/nps/vender/github.com/astaxie/beego"
16-
"github.com/cnlh/nps/vender/github.com/astaxie/beego/logs"
15+
"github.com/astaxie/beego"
16+
"github.com/astaxie/beego/logs"
1717
"net"
1818
"os"
1919
"strconv"

client/client.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import (
77
"github.com/cnlh/nps/lib/conn"
88
"github.com/cnlh/nps/lib/crypt"
99
"github.com/cnlh/nps/lib/mux"
10-
"github.com/cnlh/nps/vender/github.com/astaxie/beego/logs"
11-
"github.com/cnlh/nps/vender/github.com/xtaci/kcp"
10+
"github.com/astaxie/beego/logs"
11+
"github.com/xtaci/kcp-go"
1212
"net"
1313
"net/http"
1414
"strconv"

client/control.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import (
1010
"github.com/cnlh/nps/lib/conn"
1111
"github.com/cnlh/nps/lib/crypt"
1212
"github.com/cnlh/nps/lib/version"
13-
"github.com/cnlh/nps/vender/github.com/astaxie/beego/logs"
14-
"github.com/cnlh/nps/vender/github.com/xtaci/kcp"
15-
"github.com/cnlh/nps/vender/golang.org/x/net/proxy"
13+
"github.com/astaxie/beego/logs"
14+
"github.com/xtaci/kcp-go"
15+
"golang.org/x/net/proxy"
1616
"io/ioutil"
1717
"log"
1818
"math"

client/health.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"github.com/cnlh/nps/lib/conn"
66
"github.com/cnlh/nps/lib/file"
77
"github.com/cnlh/nps/lib/sheap"
8-
"github.com/cnlh/nps/vender/github.com/astaxie/beego/logs"
8+
"github.com/astaxie/beego/logs"
99
"github.com/pkg/errors"
1010
"net"
1111
"net/http"

client/local.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
"github.com/cnlh/nps/lib/file"
99
"github.com/cnlh/nps/lib/mux"
1010
"github.com/cnlh/nps/server/proxy"
11-
"github.com/cnlh/nps/vender/github.com/astaxie/beego/logs"
12-
"github.com/cnlh/nps/vender/github.com/xtaci/kcp"
11+
"github.com/astaxie/beego/logs"
12+
"github.com/xtaci/kcp-go"
1313
"net"
1414
"net/http"
1515
"sync"

cmd/npc/npc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import (
99
"github.com/cnlh/nps/lib/daemon"
1010
"github.com/cnlh/nps/lib/file"
1111
"github.com/cnlh/nps/lib/version"
12-
"github.com/cnlh/nps/vender/github.com/astaxie/beego/logs"
13-
"github.com/cnlh/nps/vender/github.com/ccding/go-stun/stun"
12+
"github.com/astaxie/beego/logs"
13+
"github.com/ccding/go-stun/stun"
1414
"os"
1515
"strings"
1616
"time"

cmd/nps/nps.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212
"github.com/cnlh/nps/server/connection"
1313
"github.com/cnlh/nps/server/test"
1414
"github.com/cnlh/nps/server/tool"
15-
"github.com/cnlh/nps/vender/github.com/astaxie/beego"
16-
"github.com/cnlh/nps/vender/github.com/astaxie/beego/logs"
15+
"github.com/astaxie/beego"
16+
"github.com/astaxie/beego/logs"
1717
_ "github.com/cnlh/nps/web/routers"
1818
"log"
1919
"os"

go.mod

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module github.com/cnlh/nps
2+
3+
go 1.12
4+
5+
require (
6+
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
7+
github.com/astaxie/beego v1.12.0
8+
github.com/belogik/goes v0.0.0-20151229125003-e54d722c3aff // indirect
9+
github.com/ccding/go-stun v0.0.0-20180726100737-be486d185f3d
10+
github.com/go-ole/go-ole v1.2.4 // indirect
11+
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db
12+
github.com/klauspost/cpuid v1.2.1 // indirect
13+
github.com/klauspost/reedsolomon v1.9.2
14+
github.com/onsi/gomega v1.5.0 // indirect
15+
github.com/pkg/errors v0.8.0
16+
github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect
17+
github.com/shirou/gopsutil v2.18.12+incompatible
18+
github.com/stretchr/testify v1.3.0 // indirect
19+
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 // indirect
20+
github.com/templexxx/xor v0.0.0-20181023030647-4e92f724b73b
21+
github.com/tjfoc/gmsm v1.0.1
22+
github.com/xtaci/kcp-go v5.4.4+incompatible
23+
github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae // indirect
24+
golang.org/x/crypto v0.0.0-20181127143415-eb0de9b17e85
25+
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a
26+
golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa // indirect
27+
)
28+
29+
replace github.com/astaxie/beego => github.com/exfly/beego v1.12.0-export-init

0 commit comments

Comments
 (0)