YTSFlix_Go/vendor/github.com/anacrolix/dht/misc.go
2018-11-04 15:58:15 +01:00

21 lines
342 B
Go

package dht
import (
"net"
)
func mustListen(addr string) net.PacketConn {
ret, err := net.ListenPacket("udp", addr)
if err != nil {
panic(err)
}
return ret
}
func addrResolver(addr string) func() ([]Addr, error) {
return func() ([]Addr, error) {
ua, err := net.ResolveUDPAddr("udp", addr)
return []Addr{NewAddr(ua)}, err
}
}