Compare commits
15
Commits
dev
...
v100.26.10
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5bf590784b | ||
|
|
743369214b | ||
|
|
fb948cc346 | ||
|
|
e4dddc69c2 | ||
|
|
1049079428 | ||
|
|
7e6d8aef19 | ||
|
|
fb6b5b0b16 | ||
|
|
ab648d6f0c | ||
|
|
8257673d2d | ||
|
|
f1793a740e | ||
|
|
92c06df0c0 | ||
|
|
968d03d58b | ||
|
|
c6fcb444ab | ||
|
|
5107fdfe6c | ||
|
|
4f6b35d38d |
+1
-1
@@ -9,4 +9,4 @@ FROM scratch
|
|||||||
COPY --from=builder /go/src/ehang.io/nps/nps /
|
COPY --from=builder /go/src/ehang.io/nps/nps /
|
||||||
COPY --from=builder /go/src/ehang.io/nps/web /web
|
COPY --from=builder /go/src/ehang.io/nps/web /web
|
||||||
VOLUME /conf
|
VOLUME /conf
|
||||||
CMD ["/nps"]
|
CMD ["/nps", "service"]
|
||||||
@@ -0,0 +1,143 @@
|
|||||||
|
SET VERSION=100.26.10
|
||||||
|
SET GOPROXY=direct
|
||||||
|
|
||||||
|
SET CGO_ENABLED=0
|
||||||
|
SET GOOS=linux
|
||||||
|
SET GOARCH=amd64
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
tar -czvf linux_amd64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
tar -czvf linux_amd64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
|
SET GOARCH=386
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
tar -czvf linux_386_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
tar -czvf linux_386_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
|
SET GOARCH=arm
|
||||||
|
SET GOARM=7
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
tar -czvf linux_arm_v7_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
tar -czvf linux_arm_v7_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
|
SET GOARM=6
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
tar -czvf linux_arm_v6_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
tar -czvf linux_arm_v6_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
|
SET GOARM=5
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
tar -czvf linux_arm_v5_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
tar -czvf linux_arm_v5_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
|
SET GOARCH=arm64
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
tar -czvf linux_arm64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
tar -czvf linux_arm64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
|
SET GOARCH=mips64
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
tar -czvf linux_mips64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
tar -czvf linux_mips64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
|
SET GOARCH=mips64le
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
tar -czvf linux_mips64le_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
tar -czvf linux_mips64le_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
|
SET GOARCH=mipsle
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
tar -czvf linux_mipsle_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
tar -czvf linux_mipsle_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
|
SET GOARCH=mips
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
tar -czvf linux_mips_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
tar -czvf linux_mips_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
|
SET GOOS=freebsd
|
||||||
|
SET GOARCH=386
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
tar -czvf freebsd_386_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
tar -czvf freebsd_386_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
|
SET GOARCH=amd64
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
tar -czvf freebsd_amd64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
tar -czvf freebsd_amd64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
|
SET GOARCH=arm
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
tar -czvf freebsd_arm_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
tar -czvf freebsd_arm_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
|
SET GOOS=windows
|
||||||
|
SET GOARCH=386
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
tar -czvf windows_386_client.tar.gz npc.exe conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
tar -czvf windows_386_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps.exe
|
||||||
|
|
||||||
|
|
||||||
|
SET GOARCH=amd64
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
tar -czvf windows_amd64_client.tar.gz npc.exe conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
tar -czvf windows_amd64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps.exe
|
||||||
|
|
||||||
|
|
||||||
|
SET GOOS=darwin
|
||||||
|
SET GOARCH=amd64
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
tar -czvf darwin_amd64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
tar -czvf darwin_amd64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
|
SET GOARCH=arm64
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
tar -czvf darwin_arm64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
tar -czvf darwin_arm64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#/bash/sh
|
#/bash/sh
|
||||||
export VERSION=0.26.10
|
export VERSION=100.26.10
|
||||||
export GOPROXY=direct
|
export GOPROXY=direct
|
||||||
|
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
@@ -13,152 +13,138 @@ tar -xvf upx-3.95-amd64_linux.tar.xz
|
|||||||
cp upx-3.95-amd64_linux/upx ./
|
cp upx-3.95-amd64_linux/upx ./
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
|
||||||
tar -czvf linux_amd64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
tar -czvf linux_amd64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
|
||||||
|
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
tar -czvf linux_386_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
tar -czvf linux_386_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=freebsd GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
|
||||||
|
|
||||||
|
CGO_ENABLED=0 GOOS=freebsd GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
tar -czvf freebsd_386_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
tar -czvf freebsd_386_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
|
||||||
|
|
||||||
|
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
tar -czvf freebsd_amd64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
tar -czvf freebsd_amd64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=freebsd GOARCH=arm go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
|
||||||
|
|
||||||
|
CGO_ENABLED=0 GOOS=freebsd GOARCH=arm go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
tar -czvf freebsd_arm_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
tar -czvf freebsd_arm_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
|
||||||
|
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
tar -czvf linux_arm_v7_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
tar -czvf linux_arm_v7_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
|
||||||
|
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
tar -czvf linux_arm_v6_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
tar -czvf linux_arm_v6_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
|
||||||
|
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
tar -czvf linux_arm_v5_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
tar -czvf linux_arm_v5_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
|
||||||
tar -czvf linux_arm64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
tar -czvf linux_arm64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
|
||||||
tar -czvf linux_mips64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
tar -czvf linux_mips64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=mips64le go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
CGO_ENABLED=0 GOOS=linux GOARCH=mips64le go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
|
||||||
tar -czvf linux_mips64le_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
tar -czvf linux_mips64le_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
|
||||||
tar -czvf linux_mipsle_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
tar -czvf linux_mipsle_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=mips go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
CGO_ENABLED=0 GOOS=linux GOARCH=mips go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
|
||||||
tar -czvf linux_mips_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
tar -czvf linux_mips_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
|
||||||
tar -czvf windows_386_client.tar.gz npc.exe conf/npc.conf conf/multi_account.conf
|
tar -czvf windows_386_client.tar.gz npc.exe conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
|
||||||
tar -czvf windows_amd64_client.tar.gz npc.exe conf/npc.conf conf/multi_account.conf
|
tar -czvf windows_amd64_client.tar.gz npc.exe conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
|
||||||
tar -czvf darwin_amd64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
tar -czvf darwin_amd64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
|
||||||
|
|
||||||
|
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
|
||||||
|
tar -czvf darwin_arm64_client.tar.gz npc conf/npc.conf conf/multi_account.conf
|
||||||
|
|
||||||
|
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
tar -czvf linux_amd64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
tar -czvf linux_amd64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
|
||||||
|
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
tar -czvf linux_386_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
tar -czvf linux_386_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
|
||||||
|
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
tar -czvf linux_arm_v5_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
tar -czvf linux_arm_v5_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
|
||||||
|
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
tar -czvf linux_arm_v6_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
tar -czvf linux_arm_v6_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
|
||||||
|
|
||||||
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
tar -czvf linux_arm_v7_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
tar -czvf linux_arm_v7_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
|
||||||
tar -czvf linux_arm64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
tar -czvf linux_arm64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=freebsd GOARCH=arm go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
CGO_ENABLED=0 GOOS=freebsd GOARCH=arm go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
|
||||||
tar -czvf freebsd_arm_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
tar -czvf freebsd_arm_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=freebsd GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
CGO_ENABLED=0 GOOS=freebsd GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
|
||||||
tar -czvf freebsd_386_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
tar -czvf freebsd_386_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
|
||||||
tar -czvf freebsd_amd64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
tar -czvf freebsd_amd64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=mips go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
CGO_ENABLED=0 GOOS=linux GOARCH=mips go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
|
||||||
tar -czvf linux_mips_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
tar -czvf linux_mips_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
|
||||||
tar -czvf linux_mips64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
tar -czvf linux_mips64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=mips64le go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
CGO_ENABLED=0 GOOS=linux GOARCH=mips64le go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
|
||||||
tar -czvf linux_mips64le_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
tar -czvf linux_mips64le_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
|
||||||
tar -czvf linux_mipsle_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
tar -czvf linux_mipsle_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
|
||||||
tar -czvf darwin_amd64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
tar -czvf darwin_amd64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
tar -czvf darwin_arm64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
|
||||||
|
|
||||||
|
|
||||||
|
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
tar -czvf windows_amd64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps.exe
|
tar -czvf windows_amd64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps.exe
|
||||||
|
|
||||||
|
|
||||||
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
|
||||||
|
|
||||||
tar -czvf windows_386_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps.exe
|
tar -czvf windows_386_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps.exe
|
||||||
|
|
||||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
|
||||||
@@ -170,8 +156,8 @@ docker run --rm -i -w /app -v $(pwd):/app -e ANDROID_HOME=/usr/local/android_sdk
|
|||||||
git clone https://github.com/cnlh/spksrc.git ~/spksrc
|
git clone https://github.com/cnlh/spksrc.git ~/spksrc
|
||||||
mkdir ~/spksrc/nps && cp -rf ./* ~/spksrc/nps/
|
mkdir ~/spksrc/nps && cp -rf ./* ~/spksrc/nps/
|
||||||
docker run -itd --name spksrc --env VERSION=$VERSION -e GOPROXY=direct -v ~/spksrc:/spksrc synocommunity/spksrc /bin/bash
|
docker run -itd --name spksrc --env VERSION=$VERSION -e GOPROXY=direct -v ~/spksrc:/spksrc synocommunity/spksrc /bin/bash
|
||||||
docker exec -it spksrc /bin/bash -c 'cd /spksrc && make setup && cd /spksrc/spk/npc && make'
|
docker exec -it spksrc /bin/bash -c 'cd /spksrc && make setup && cd /spksrc/spk/npc && make arch-x64-7.0'
|
||||||
cp ~/spksrc/packages/npc_noarch-all_$VERSION-1.spk ./npc_syno.spk
|
cp ~/spksrc/packages/npc_x64-7.0_$VERSION-1.spk ./npc_syno.spk
|
||||||
|
|
||||||
|
|
||||||
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||

|

|
||||||
|
|
||||||
# NPS <small>0.26.10</small>
|
# NPS <small>100.26.10</small>
|
||||||
|
|
||||||
> 一款轻量级、高性能、功能强大的内网穿透代理服务器
|
> 一款轻量级、高性能、功能强大的内网穿透代理服务器
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
```
|
```
|
||||||
命令行模式启动客户端
|
命令行模式启动客户端
|
||||||
从v0.26.10开始,此函数会阻塞,直到客户端退出返回,请自行管理是否重连
|
从v100.26.10开始,此函数会阻塞,直到客户端退出返回,请自行管理是否重连
|
||||||
p0->连接地址
|
p0->连接地址
|
||||||
p1->vkey
|
p1->vkey
|
||||||
p2->连接类型(tcp or udp)
|
p2->连接类型(tcp or udp)
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
**方式一:** 类似于nginx实现https的处理
|
**方式一:** 类似于nginx实现https的处理
|
||||||
|
|
||||||
在配置文件中将https_proxy_port设置为443或者其他你想配置的端口,和在web中对应域名编辑中设置对应的证书路径,将`https_just_proxy`设置为false,然后就和http代理一样了
|
在配置文件中将https_proxy_port设置为443或者其他你想配置的端口,将`https_just_proxy`设置为false,nps 重启后,在web管理界面,域名新增或修改界面中修改域名证书和密钥。
|
||||||
|
|
||||||
**此外:** 可以在`nps.conf`中设置一个默认的https配置,当遇到未在web中设置https证书的域名解析时,将自动使用默认证书,另还有一种情况就是对于某些请求的clienthello不携带sni扩展信息,nps也将自动使用默认证书
|
**此外:** 可以在`nps.conf`中设置一个默认的https配置,当遇到未在web中设置https证书的域名解析时,将自动使用默认证书,另还有一种情况就是对于某些请求的clienthello不携带sni扩展信息,nps也将自动使用默认证书
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -53,8 +53,8 @@ npc-update.exe update
|
|||||||
server_addr=1.1.1.1:8024
|
server_addr=1.1.1.1:8024
|
||||||
conn_type=tcp
|
conn_type=tcp
|
||||||
vkey=123
|
vkey=123
|
||||||
username=111
|
basic_username=111
|
||||||
password=222
|
basic_password=222
|
||||||
compress=true
|
compress=true
|
||||||
crypt=true
|
crypt=true
|
||||||
rate_limit=10000
|
rate_limit=10000
|
||||||
@@ -68,8 +68,8 @@ max_conn=10
|
|||||||
server_addr | 服务端ip/域名:port
|
server_addr | 服务端ip/域名:port
|
||||||
conn_type | 与服务端通信模式(tcp或kcp)
|
conn_type | 与服务端通信模式(tcp或kcp)
|
||||||
vkey|服务端配置文件中的密钥(非web)
|
vkey|服务端配置文件中的密钥(非web)
|
||||||
username|socks5或http(s)密码保护用户名(可忽略)
|
basic_username|socks5或http(s)密码保护用户名(可忽略)
|
||||||
password|socks5或http(s)密码保护密码(可忽略)
|
basic_password|socks5或http(s)密码保护密码(可忽略)
|
||||||
compress|是否压缩传输(true或false或忽略)
|
compress|是否压缩传输(true或false或忽略)
|
||||||
crypt|是否加密传输(true或false或忽略)
|
crypt|是否加密传输(true或false或忽略)
|
||||||
rate_limit|速度限制,可忽略
|
rate_limit|速度限制,可忽略
|
||||||
@@ -159,7 +159,7 @@ multi_account=multi_account.conf
|
|||||||
---|---
|
---|---
|
||||||
mode | socks5
|
mode | socks5
|
||||||
server_port | 在服务端的代理端口
|
server_port | 在服务端的代理端口
|
||||||
multi_account | socks5多账号配置文件(可选),配置后使用basic_username和basic_password无法通过认证
|
multi_account | socks5多账号配置文件(可选),配置后使用basic_username和basic_password无法通过认证 <br> multi_account.conf要与可执行文件npc同一目录,或者npc.conf里面写相对路径,conf/multi_account.conf
|
||||||
#### 私密代理模式
|
#### 私密代理模式
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.nps.client"
|
package="org.nps.client"
|
||||||
android:versionCode="1"
|
android:versionCode="1"
|
||||||
android:versionName="0.26.10">
|
android:versionName="100.26.10">
|
||||||
|
|
||||||
<application android:label="Npc" android:debuggable="true">
|
<application android:label="Npc" android:debuggable="true">
|
||||||
<activity android:name="org.golang.app.GoNativeActivity"
|
<activity android:name="org.golang.app.GoNativeActivity"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
package version
|
package version
|
||||||
|
|
||||||
const VERSION = "0.26.10"
|
const VERSION = "100.26.10"
|
||||||
|
|
||||||
// Compulsory minimum version, Minimum downward compatibility to this version
|
// Compulsory minimum version, Minimum downward compatibility to this version
|
||||||
func GetVersion() string {
|
func GetVersion() string {
|
||||||
return "0.26.0"
|
return "100.26.0"
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-11
@@ -20,7 +20,7 @@ type BaseController struct {
|
|||||||
actionName string
|
actionName string
|
||||||
}
|
}
|
||||||
|
|
||||||
//初始化参数
|
// 初始化参数
|
||||||
func (s *BaseController) Prepare() {
|
func (s *BaseController) Prepare() {
|
||||||
s.Data["web_base_url"] = beego.AppConfig.String("web_base_url")
|
s.Data["web_base_url"] = beego.AppConfig.String("web_base_url")
|
||||||
controllerName, actionName := s.GetControllerAndAction()
|
controllerName, actionName := s.GetControllerAndAction()
|
||||||
@@ -33,6 +33,9 @@ func (s *BaseController) Prepare() {
|
|||||||
timestamp := s.GetIntNoErr("timestamp")
|
timestamp := s.GetIntNoErr("timestamp")
|
||||||
configKey := beego.AppConfig.String("auth_key")
|
configKey := beego.AppConfig.String("auth_key")
|
||||||
timeNowUnix := time.Now().Unix()
|
timeNowUnix := time.Now().Unix()
|
||||||
|
if configKey == "" {
|
||||||
|
configKey = crypt.GetRandomString(128)
|
||||||
|
}
|
||||||
if !(md5Key != "" && (math.Abs(float64(timeNowUnix-int64(timestamp))) <= 20) && (crypt.Md5(configKey+strconv.Itoa(timestamp)) == md5Key)) {
|
if !(md5Key != "" && (math.Abs(float64(timeNowUnix-int64(timestamp))) <= 20) && (crypt.Md5(configKey+strconv.Itoa(timestamp)) == md5Key)) {
|
||||||
if s.GetSession("auth") != true {
|
if s.GetSession("auth") != true {
|
||||||
s.Redirect(beego.AppConfig.String("web_base_url")+"/login/index", 302)
|
s.Redirect(beego.AppConfig.String("web_base_url")+"/login/index", 302)
|
||||||
@@ -62,7 +65,7 @@ func (s *BaseController) Prepare() {
|
|||||||
s.Data["allow_user_change_username"], _ = beego.AppConfig.Bool("allow_user_change_username")
|
s.Data["allow_user_change_username"], _ = beego.AppConfig.Bool("allow_user_change_username")
|
||||||
}
|
}
|
||||||
|
|
||||||
//加载模板
|
// 加载模板
|
||||||
func (s *BaseController) display(tpl ...string) {
|
func (s *BaseController) display(tpl ...string) {
|
||||||
s.Data["web_base_url"] = beego.AppConfig.String("web_base_url")
|
s.Data["web_base_url"] = beego.AppConfig.String("web_base_url")
|
||||||
var tplname string
|
var tplname string
|
||||||
@@ -86,19 +89,19 @@ func (s *BaseController) display(tpl ...string) {
|
|||||||
s.TplName = tplname
|
s.TplName = tplname
|
||||||
}
|
}
|
||||||
|
|
||||||
//错误
|
// 错误
|
||||||
func (s *BaseController) error() {
|
func (s *BaseController) error() {
|
||||||
s.Data["web_base_url"] = beego.AppConfig.String("web_base_url")
|
s.Data["web_base_url"] = beego.AppConfig.String("web_base_url")
|
||||||
s.Layout = "public/layout.html"
|
s.Layout = "public/layout.html"
|
||||||
s.TplName = "public/error.html"
|
s.TplName = "public/error.html"
|
||||||
}
|
}
|
||||||
|
|
||||||
//getEscapeString
|
// getEscapeString
|
||||||
func (s *BaseController) getEscapeString(key string) string {
|
func (s *BaseController) getEscapeString(key string) string {
|
||||||
return html.EscapeString(s.GetString(key))
|
return html.EscapeString(s.GetString(key))
|
||||||
}
|
}
|
||||||
|
|
||||||
//去掉没有err返回值的int
|
// 去掉没有err返回值的int
|
||||||
func (s *BaseController) GetIntNoErr(key string, def ...int) int {
|
func (s *BaseController) GetIntNoErr(key string, def ...int) int {
|
||||||
strv := s.Ctx.Input.Query(key)
|
strv := s.Ctx.Input.Query(key)
|
||||||
if len(strv) == 0 && len(def) > 0 {
|
if len(strv) == 0 && len(def) > 0 {
|
||||||
@@ -108,7 +111,7 @@ func (s *BaseController) GetIntNoErr(key string, def ...int) int {
|
|||||||
return val
|
return val
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取去掉错误的bool值
|
// 获取去掉错误的bool值
|
||||||
func (s *BaseController) GetBoolNoErr(key string, def ...bool) bool {
|
func (s *BaseController) GetBoolNoErr(key string, def ...bool) bool {
|
||||||
strv := s.Ctx.Input.Query(key)
|
strv := s.Ctx.Input.Query(key)
|
||||||
if len(strv) == 0 && len(def) > 0 {
|
if len(strv) == 0 && len(def) > 0 {
|
||||||
@@ -118,21 +121,21 @@ func (s *BaseController) GetBoolNoErr(key string, def ...bool) bool {
|
|||||||
return val
|
return val
|
||||||
}
|
}
|
||||||
|
|
||||||
//ajax正确返回
|
// ajax正确返回
|
||||||
func (s *BaseController) AjaxOk(str string) {
|
func (s *BaseController) AjaxOk(str string) {
|
||||||
s.Data["json"] = ajax(str, 1)
|
s.Data["json"] = ajax(str, 1)
|
||||||
s.ServeJSON()
|
s.ServeJSON()
|
||||||
s.StopRun()
|
s.StopRun()
|
||||||
}
|
}
|
||||||
|
|
||||||
//ajax错误返回
|
// ajax错误返回
|
||||||
func (s *BaseController) AjaxErr(str string) {
|
func (s *BaseController) AjaxErr(str string) {
|
||||||
s.Data["json"] = ajax(str, 0)
|
s.Data["json"] = ajax(str, 0)
|
||||||
s.ServeJSON()
|
s.ServeJSON()
|
||||||
s.StopRun()
|
s.StopRun()
|
||||||
}
|
}
|
||||||
|
|
||||||
//组装ajax
|
// 组装ajax
|
||||||
func ajax(str string, status int) map[string]interface{} {
|
func ajax(str string, status int) map[string]interface{} {
|
||||||
json := make(map[string]interface{})
|
json := make(map[string]interface{})
|
||||||
json["status"] = status
|
json["status"] = status
|
||||||
@@ -140,7 +143,7 @@ func ajax(str string, status int) map[string]interface{} {
|
|||||||
return json
|
return json
|
||||||
}
|
}
|
||||||
|
|
||||||
//ajax table返回
|
// ajax table返回
|
||||||
func (s *BaseController) AjaxTable(list interface{}, cnt int, recordsTotal int, kwargs map[string]interface{}) {
|
func (s *BaseController) AjaxTable(list interface{}, cnt int, recordsTotal int, kwargs map[string]interface{}) {
|
||||||
json := make(map[string]interface{})
|
json := make(map[string]interface{})
|
||||||
json["rows"] = list
|
json["rows"] = list
|
||||||
@@ -157,7 +160,7 @@ func (s *BaseController) AjaxTable(list interface{}, cnt int, recordsTotal int,
|
|||||||
s.StopRun()
|
s.StopRun()
|
||||||
}
|
}
|
||||||
|
|
||||||
//ajax table参数
|
// ajax table参数
|
||||||
func (s *BaseController) GetAjaxParams() (start, limit int) {
|
func (s *BaseController) GetAjaxParams() (start, limit int) {
|
||||||
return s.GetIntNoErr("offset"), s.GetIntNoErr("limit")
|
return s.GetIntNoErr("offset"), s.GetIntNoErr("limit")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,6 +102,8 @@ func (s *ClientController) Edit() {
|
|||||||
} else {
|
} else {
|
||||||
if c, err := file.GetDb().GetClient(id); err != nil {
|
if c, err := file.GetDb().GetClient(id); err != nil {
|
||||||
s.error()
|
s.error()
|
||||||
|
s.AjaxErr("client ID not found")
|
||||||
|
return
|
||||||
} else {
|
} else {
|
||||||
if s.getEscapeString("web_username") != "" {
|
if s.getEscapeString("web_username") != "" {
|
||||||
if s.getEscapeString("web_username") == beego.AppConfig.String("web_username") || !file.GetDb().VerifyUserName(s.getEscapeString("web_username"), c.Id) {
|
if s.getEscapeString("web_username") == beego.AppConfig.String("web_username") || !file.GetDb().VerifyUserName(s.getEscapeString("web_username"), c.Id) {
|
||||||
|
|||||||
Reference in New Issue
Block a user