Skip to content

Commit

Permalink
v0.0.3 - 优化参数解析
Browse files Browse the repository at this point in the history
  • Loading branch information
spiritLHLS committed Jul 2, 2024
1 parent 9ccd57c commit 615823d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
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:
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 14 additions & 7 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}()
Expand Down
2 changes: 1 addition & 1 deletion model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 615823d

Please sign in to comment.