add version module

This commit is contained in:
xvzc 2024-08-07 07:32:35 +09:00
parent 641ded49d8
commit 6c66b2857c
4 changed files with 16 additions and 6 deletions

1
.version Normal file
View File

@ -0,0 +1 @@
v0.10.6

View File

@ -4,21 +4,20 @@ import (
"os"
"os/signal"
"syscall"
_ "embed"
"github.com/sirupsen/logrus"
log "github.com/sirupsen/logrus"
"github.com/xvzc/SpoofDPI/proxy"
"github.com/xvzc/SpoofDPI/util"
"github.com/xvzc/SpoofDPI/version"
)
var VERSION = "v0.0.0(dev)"
func main() {
util.ParseArgs()
config := util.GetConfig()
if *config.Version {
println("spoog-dpi", VERSION)
println("\nA simple and fast anti-censorship tool written in Go.")
println("https://github.com/xvzc/SpoofDPI")
PrintVersion()
os.Exit(0)
}

View File

@ -1,7 +1,5 @@
#!/bin/bash
VERSION="v0.10.6"
for osarch in 'darwin/amd64' 'darwin/arm64' 'linux/amd64' 'linux/arm' 'linux/arm64' 'linux/mips' 'linux/mipsle'; do
GOOS=${osarch%/*} GOARCH=${osarch#*/} go build -ldflags="-w -s -X main.VERSION=${VERSION}" github.com/xvzc/SpoofDPI/cmd/spoof-dpi &&
tar -zcvf spoof-dpi-${osarch%/*}-${osarch#*/}.tar.gz ./spoof-dpi &&

12
version.go Normal file
View File

@ -0,0 +1,12 @@
package version
import _ "embed"
//go:embed .version
var VERSION string
func PrintVersion() {
println("spoof-dpi", VERSION)
println("A simple and fast anti-censorship tool written in Go.")
println("https://github.com/xvzc/SpoofDPI")
}