From 3cbe432889d368ec4ab97f4621be24e1093744f7 Mon Sep 17 00:00:00 2001 From: fatedier Date: Mon, 29 Feb 2016 14:56:47 +0800 Subject: [PATCH] cmd/client: if no local_ip set in proxy config, use 127.0.0.1 as default --- conf/frpc.ini | 6 +++--- conf/frps.ini | 6 +++--- src/frp/models/client/config.go | 5 +++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/conf/frpc.ini b/conf/frpc.ini index c424fe8f..cf9c52a3 100644 --- a/conf/frpc.ini +++ b/conf/frpc.ini @@ -1,4 +1,4 @@ -# common是必须的section +# [common] is integral section [common] server_addr = 127.0.0.1 server_port = 7000 @@ -6,9 +6,9 @@ log_file = ./frpc.log # debug, info, warn, error log_level = debug # file, console -log_way = console +log_way = file -# test1即为name +# test1 is the proxy name same as server's configuration [test1] passwd = 123 local_ip = 127.0.0.1 diff --git a/conf/frps.ini b/conf/frps.ini index 0c44cb1f..f07a73a6 100644 --- a/conf/frps.ini +++ b/conf/frps.ini @@ -1,4 +1,4 @@ -# common是必须的section +# [common] is integral section [common] bind_addr = 0.0.0.0 bind_port = 7000 @@ -6,9 +6,9 @@ log_file = ./frps.log # debug, info, warn, error log_level = debug # file, console -log_way = console +log_way = file -# test1即为name +# test1 is the proxy name, client will use this name and passwd to connect to server [test1] passwd = 123 bind_addr = 0.0.0.0 diff --git a/src/frp/models/client/config.go b/src/frp/models/client/config.go index 0e3f8146..e74c3ac3 100644 --- a/src/frp/models/client/config.go +++ b/src/frp/models/client/config.go @@ -55,7 +55,7 @@ func LoadConf(confFile string) (err error) { LogWay = tmpStr } - // servers + // proxies for name, section := range conf { if name != "common" { proxyClient := &ProxyClient{} @@ -68,7 +68,8 @@ func LoadConf(confFile string) (err error) { proxyClient.LocalIp, ok = section["local_ip"] if !ok { - return fmt.Errorf("Parse ini file error: proxy [%s] no local_ip found", proxyClient.Name) + // use 127.0.0.1 as default + proxyClient.LocalIp = "127.0.0.1" } portStr, ok := section["local_port"]