21 lines
488 B
Go
21 lines
488 B
Go
package reuseport
|
|
|
|
import (
|
|
"net"
|
|
)
|
|
|
|
func ResolveAddr(network, address string) (net.Addr, error) {
|
|
switch network {
|
|
default:
|
|
return nil, net.UnknownNetworkError(network)
|
|
case "ip", "ip4", "ip6":
|
|
return net.ResolveIPAddr(network, address)
|
|
case "tcp", "tcp4", "tcp6":
|
|
return net.ResolveTCPAddr(network, address)
|
|
case "udp", "udp4", "udp6":
|
|
return net.ResolveUDPAddr(network, address)
|
|
case "unix", "unixgram", "unixpacket":
|
|
return net.ResolveUnixAddr(network, address)
|
|
}
|
|
}
|