diff --git a/cmd/shadowsocks-local/local.go b/cmd/shadowsocks-local/local.go index 79ff991..d09fe38 100644 --- a/cmd/shadowsocks-local/local.go +++ b/cmd/shadowsocks-local/local.go @@ -4,6 +4,7 @@ import ( "bytes" "encoding/binary" "errors" + "flag" ss "github.com/shadowsocks/shadowsocks-go/shadowsocks" "io" "log" @@ -195,7 +196,11 @@ func run(port, password, server string) { } func main() { - config := ss.ParseConfig("config.json") + var configFile string + flag.StringVar(&configFile, "c", "config.json", "specify config file") + flag.Parse() + + config := ss.ParseConfig(configFile) debug = ss.Debug run(strconv.Itoa(config.LocalPort), config.Password, config.Server+":"+strconv.Itoa(config.ServerPort)) diff --git a/cmd/shadowsocks-server/server.go b/cmd/shadowsocks-server/server.go index d24a4ee..b28d5a9 100644 --- a/cmd/shadowsocks-server/server.go +++ b/cmd/shadowsocks-server/server.go @@ -4,6 +4,7 @@ import ( "bytes" "encoding/binary" "errors" + "flag" ss "github.com/shadowsocks/shadowsocks-go/shadowsocks" "log" "net" @@ -162,7 +163,11 @@ func run(port, password string) { } func main() { - config := ss.ParseConfig("config.json") + var configFile string + flag.StringVar(&configFile, "c", "config.json", "specify config file") + flag.Parse() + + config := ss.ParseConfig(configFile) debug = ss.Debug if len(config.PortPassword) == 0 { run(strconv.Itoa(config.ServerPort), config.Password)