cmd/client: if no local_ip set in proxy config, use 127.0.0.1 as default

pull/7/head
fatedier 9 years ago
parent 586d63f662
commit 3cbe432889

@ -1,4 +1,4 @@
# common是必须的section # [common] is integral section
[common] [common]
server_addr = 127.0.0.1 server_addr = 127.0.0.1
server_port = 7000 server_port = 7000
@ -6,9 +6,9 @@ log_file = ./frpc.log
# debug, info, warn, error # debug, info, warn, error
log_level = debug log_level = debug
# file, console # file, console
log_way = console log_way = file
# test1即为name # test1 is the proxy name same as server's configuration
[test1] [test1]
passwd = 123 passwd = 123
local_ip = 127.0.0.1 local_ip = 127.0.0.1

@ -1,4 +1,4 @@
# common是必须的section # [common] is integral section
[common] [common]
bind_addr = 0.0.0.0 bind_addr = 0.0.0.0
bind_port = 7000 bind_port = 7000
@ -6,9 +6,9 @@ log_file = ./frps.log
# debug, info, warn, error # debug, info, warn, error
log_level = debug log_level = debug
# file, console # 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] [test1]
passwd = 123 passwd = 123
bind_addr = 0.0.0.0 bind_addr = 0.0.0.0

@ -55,7 +55,7 @@ func LoadConf(confFile string) (err error) {
LogWay = tmpStr LogWay = tmpStr
} }
// servers // proxies
for name, section := range conf { for name, section := range conf {
if name != "common" { if name != "common" {
proxyClient := &ProxyClient{} proxyClient := &ProxyClient{}
@ -68,7 +68,8 @@ func LoadConf(confFile string) (err error) {
proxyClient.LocalIp, ok = section["local_ip"] proxyClient.LocalIp, ok = section["local_ip"]
if !ok { 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"] portStr, ok := section["local_port"]

Loading…
Cancel
Save