mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-17 19:08:25 -07:00
15 lines
288 B
Go
15 lines
288 B
Go
|
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 ""
|
||
|
}
|