diff --git a/stunning.go b/stunning.go index 4971abe..92eb8bb 100644 --- a/stunning.go +++ b/stunning.go @@ -1,4 +1,4 @@ -package stunning +package main import ( "encoding/json" @@ -298,15 +298,14 @@ func TunnelFactory(name string, conf TunnelConfig) TunnelCommon { } func main() { - argsWithoutProg := os.Args[1:] var confFile string - for i := 0; i < len(argsWithoutProg); i++ { - arg := argsWithoutProg[i] - if arg[:8] == "--config=" { - confFile = arg[8:] - } else if arg == "-c" && i+1 <= len(argsWithoutProg) { + for i := 1 ; i < len(os.Args); i++ { + arg := os.Args[i] + if len(arg) > 9 && arg[:9] == "--config=" { + confFile = arg[9:] + } else if len(arg) == 2 && arg[:2] == "-c" && i+1 <= len(os.Args) { i++ - arg := argsWithoutProg[i] + arg := os.Args[i] confFile = arg } else if arg[:2] == "-c" && len(arg) > 2 { confFile = arg[2:] diff --git a/socks_test.go b/test/socks_test.go similarity index 99% rename from socks_test.go rename to test/socks_test.go index 9ac8746..2b88753 100644 --- a/socks_test.go +++ b/test/socks_test.go @@ -1,4 +1,4 @@ -package stunning +package test import ( "fmt" diff --git a/tcp_test.go b/test/tcp_test.go similarity index 99% rename from tcp_test.go rename to test/tcp_test.go index 107dbdd..369e4a8 100644 --- a/tcp_test.go +++ b/test/tcp_test.go @@ -1,4 +1,4 @@ -package stunning +package test import ( "fmt" diff --git a/tun_test.go b/test/tun_test.go similarity index 98% rename from tun_test.go rename to test/tun_test.go index c65624d..74c5b92 100644 --- a/tun_test.go +++ b/test/tun_test.go @@ -1,4 +1,4 @@ -package stunning +package test import ( "fmt"