Skip to content

Commit

Permalink
cmd/client: if no local_ip set in proxy config, use 127.0.0.1 as default
Browse files Browse the repository at this point in the history
  • Loading branch information
fatedier committed Feb 29, 2016
1 parent 586d63f commit 3cbe432
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions conf/frpc.ini
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# common是必须的section
# [common] is integral section
[common]
server_addr = 127.0.0.1
server_port = 7000
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
Expand Down
6 changes: 3 additions & 3 deletions conf/frps.ini
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# common是必须的section
# [common] is integral section
[common]
bind_addr = 0.0.0.0
bind_port = 7000
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
Expand Down
5 changes: 3 additions & 2 deletions src/frp/models/client/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func LoadConf(confFile string) (err error) {
LogWay = tmpStr
}

// servers
// proxies
for name, section := range conf {
if name != "common" {
proxyClient := &ProxyClient{}
Expand All @@ -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"]
Expand Down

0 comments on commit 3cbe432

Please sign in to comment.