add support for command line

This commit is contained in:
fatedier
2016-03-14 00:21:40 +08:00
parent 838dc10c6e
commit 975c2a97c8
13 changed files with 2449 additions and 16 deletions

View File

@@ -10,10 +10,10 @@ import (
// common config
var (
BindAddr string = "0.0.0.0"
BindPort int64 = 9527
LogFile string = "./frps.log"
LogLevel string = "warn"
LogWay string = "file"
BindPort int64 = 7000
LogFile string = "console"
LogWay string = "console" // console or file
LogLevel string = "info"
HeartBeatTimeout int64 = 30
UserConnTimeout int64 = 10
)
@@ -43,6 +43,11 @@ func LoadConf(confFile string) (err error) {
tmpStr, ok = conf.Get("common", "log_file")
if ok {
LogFile = tmpStr
if LogFile == "console" {
LogWay = "console"
} else {
LogWay = "file"
}
}
tmpStr, ok = conf.Get("common", "log_level")
@@ -50,11 +55,6 @@ func LoadConf(confFile string) (err error) {
LogLevel = tmpStr
}
tmpStr, ok = conf.Get("common", "log_way")
if ok {
LogWay = tmpStr
}
// servers
for name, section := range conf {
if name != "common" {