YTSFlix_Go/vendor/github.com/anacrolix/dht/misc.go

21 lines
342 B
Go
Raw Normal View History

2018-11-04 14:58:15 +00:00
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
}
}