util.AddrIP, TCPAddr

This commit is contained in:
Matt Joiner 2015-03-08 17:44:08 +11:00
parent 1663a8a2f5
commit 0c7c2e1955
1 changed files with 2 additions and 0 deletions

View File

@ -27,6 +27,8 @@ func AddrIP(addr net.Addr) net.IP {
switch raw := addr.(type) {
case *net.UDPAddr:
return raw.IP
case *net.TCPAddr:
return raw.IP
default:
host, _, err := net.SplitHostPort(addr.String())
if err != nil {