Skip to content

Commit

Permalink
compitable previous public ip setting (netsec-ethz#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny authored Jul 12, 2019
1 parent 2ddf435 commit c46bdf8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ func (conn *Conn) PublicIp() string {
}

func (conn *Conn) passiveListenIP() string {
var listenIP string
if len(conn.PublicIp()) > 0 {
return conn.PublicIp()
listenIP = conn.PublicIp()
} else {
listenIP = conn.conn.LocalAddr().String()
}
listenIP := conn.conn.LocalAddr().String()

lastIdx := strings.LastIndex(listenIP, ":")
if lastIdx <= 0 {
return listenIP
Expand Down

0 comments on commit c46bdf8

Please sign in to comment.