Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADD version option to command line #176

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import (
"github.com/shadowsocks/go-shadowsocks2/socks"
)

const AppVersion = "v0.1.0"

var config struct {
Verbose bool
UDPTimeout time.Duration
Expand All @@ -40,6 +42,7 @@ func main() {
UDPSocks bool
Plugin string
PluginOpts string
Version bool
}

flag.BoolVar(&config.Verbose, "verbose", false, "verbose mode")
Expand All @@ -58,8 +61,14 @@ func main() {
flag.StringVar(&flags.Plugin, "plugin", "", "Enable SIP003 plugin. (e.g., v2ray-plugin)")
flag.StringVar(&flags.PluginOpts, "plugin-opts", "", "Set SIP003 plugin options. (e.g., \"server;tls;host=mydomain.me\")")
flag.DurationVar(&config.UDPTimeout, "udptimeout", 5*time.Minute, "UDP tunnel timeout")
flag.BoolVar(&flags.Version, "version", false, "prints current version")
flag.Parse()

if flags.Version {
fmt.Println(AppVersion)
os.Exit(0)
}

if flags.Keygen > 0 {
key := make([]byte, flags.Keygen)
io.ReadFull(rand.Reader, key)
Expand Down