Files
indra/pkg/engine/eng_common.go
херетик 3f5a39642c separated onions from engine fully
some stuff had to get merged into it due to circular dependencies so I guess what is in onions now is all onions.
2023-04-17 12:30:04 +01:00

22 lines
356 B
Go

package engine
import (
"net"
"net/netip"
)
func GetNetworkFromAddrPort(addr string) (nw string, u *net.UDPAddr,
e error) {
nw = "udp"
var ap netip.AddrPort
if ap, e = netip.ParseAddrPort(addr); fails(e) {
return
}
u = &net.UDPAddr{IP: net.ParseIP(ap.Addr().String()), Port: int(ap.Port())}
if u.IP.To4() != nil {
nw = "udp4"
}
return
}