Return the IP from the connection RemoteAddr
()
| 137 | |
| 138 | // Return the IP from the connection RemoteAddr |
| 139 | func (pc peerConn) RemoteIP() net.IP { |
| 140 | if pc.ip != nil { |
| 141 | return pc.ip |
| 142 | } |
| 143 | |
| 144 | host, _, err := net.SplitHostPort(pc.conn.RemoteAddr().String()) |
| 145 | if err != nil { |
| 146 | panic(err) |
| 147 | } |
| 148 | |
| 149 | ips, err := net.LookupIP(host) |
| 150 | if err != nil { |
| 151 | panic(err) |
| 152 | } |
| 153 | |
| 154 | pc.ip = ips[0] |
| 155 | |
| 156 | return pc.ip |
| 157 | } |
| 158 | |
| 159 | // peer implements Peer. |
| 160 | // |
nothing calls this directly
no test coverage detected