Skip to content

Commit

Permalink
Merge pull request shadowsocks#61 from lcdtyph/master
Browse files Browse the repository at this point in the history
Add a flag to show version of v2ray-plugin
  • Loading branch information
madeye authored Mar 6, 2019
2 parents cb3d8b9 + 1cc0f93 commit a3b8add
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ import (
"v2ray.com/core/common/platform/filesystem"
)

var (
VERSION = "custom"
)

var (
vpn = flag.Bool("V", false, "Run in VPN mode.")
fastOpen = flag.Bool("fast-open", false, "Enable TCP fast open.")
Expand All @@ -56,6 +60,7 @@ var (
mux = flag.Int("mux", 1, "Concurrent multiplexed connections (websocket client mode only).")
server = flag.Bool("server", false, "Run in server mode")
logLevel = flag.String("loglevel", "", "loglevel for v2ray: debug, info, warning (default), error, none.")
version = flag.Bool("version", false, "Show current version of v2ray-plugin")
)

func homeDir() string {
Expand Down Expand Up @@ -318,19 +323,29 @@ func startV2Ray() (core.Server, error) {
return instance, nil
}

func printVersion() {
func printCoreVersion() {
version := core.VersionStatement()
for _, s := range version {
logInfo(s)
}
}

func printVersion() {
fmt.Println("v2ray-plugin", VERSION);
fmt.Println("Yet another SIP003 plugin for shadowsocks");
}

func main() {
flag.Parse()

if *version {
printVersion()
return
}

logInit()

printVersion()
printCoreVersion()

server, err := startV2Ray()
if err != nil {
Expand Down

0 comments on commit a3b8add

Please sign in to comment.