AdGuardHome/dnsforward/helpers.go

15 lines
288 B
Go
Raw Normal View History

2019-06-04 10:38:53 -07:00
package dnsforward
import "net"
// GetIPString is a helper function that extracts IP address from net.Addr
func GetIPString(addr net.Addr) string {
switch addr := addr.(type) {
case *net.UDPAddr:
return addr.IP.String()
case *net.TCPAddr:
return addr.IP.String()
}
return ""
}