From 615823d603366485344bbfb4d1805896e7c460d8 Mon Sep 17 00:00:00 2001 From: spiritlhl <103393591+spiritLHLS@users.noreply.github.com> Date: Tue, 2 Jul 2024 05:45:13 +0000 Subject: [PATCH] =?UTF-8?q?v0.0.3=20-=20=E4=BC=98=E5=8C=96=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E8=A7=A3=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yaml | 2 +- README.md | 4 +--- cmd/main.go | 21 ++++++++++++++------- model/model.go | 2 +- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 392d73d..5b4c9ef 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,7 +24,7 @@ jobs: run: | git config --global user.name 'github-actions' git config --global user.email 'github-actions@github.com' - TAG="v0.0.2-$(date +'%Y%m%d%H%M%S')" + TAG="v0.0.3-$(date +'%Y%m%d%H%M%S')" git tag $TAG git push origin $TAG env: diff --git a/README.md b/README.md index ff24d3c..93352a0 100644 --- a/README.md +++ b/README.md @@ -39,9 +39,7 @@ address and port dependent ## 使用说明[Usage] -更新时间[Version]: 2024.06.25 - -下载及安装 +下载、安装、更新 ``` curl https://raw.githubusercontent.com/oneclickvirt/gostun/main/gostun_install.sh -sSf | sh diff --git a/cmd/main.go b/cmd/main.go index 2b4e9d5..837e556 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -12,13 +12,20 @@ import ( ) func main() { - var showVersion bool - flag.BoolVar(&showVersion, "v", false, "show version") - flag.IntVar(&model.Verbose, "verbose", 0, "the verbosity level") - flag.IntVar(&model.Timeout, "timeout", 3, "the number of seconds to wait for STUN server's response") - flag.StringVar(&model.AddrStr, "server", "stun.voipgate.com:3478", "STUN server address") - flag.BoolVar(&model.EnableLoger, "e", true, "Enable logging") - flag.Parse() + var showVersion, help bool + gostunFlag := flag.NewFlagSet("gostun", flag.ContinueOnError) + gostunFlag.BoolVar(&help, "h", false, "Display help information") + gostunFlag.BoolVar(&showVersion, "v", false, "Display version information") + gostunFlag.IntVar(&model.Verbose, "verbose", 0, "Set verbosity level") + gostunFlag.IntVar(&model.Timeout, "timeout", 3, "Set timeout in seconds for STUN server response") + gostunFlag.StringVar(&model.AddrStr, "server", "stun.voipgate.com:3478", "Specify STUN server address") + gostunFlag.BoolVar(&model.EnableLoger, "e", true, "Enable logging functionality") + gostunFlag.Parse(os.Args[1:]) + if help { + fmt.Printf("Usage: %s [options]\n", os.Args[0]) + gostunFlag.PrintDefaults() + return + } go func() { http.Get("https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Foneclickvirt%2Fgostun&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false") }() diff --git a/model/model.go b/model/model.go index b297e31..2db7ddc 100644 --- a/model/model.go +++ b/model/model.go @@ -2,7 +2,7 @@ package model import "github.com/pion/logging" -const GoStunVersion = "v0.0.2" +const GoStunVersion = "v0.0.3" var ( AddrStr = "stun.voipgate.com:3478"