utp.go 440 B

123456789101112131415161718
  1. package torrent
  2. import (
  3. "context"
  4. "net"
  5. )
  6. // Abstracts the utp Socket, so the implementation can be selected from
  7. // different packages.
  8. type utpSocket interface {
  9. net.PacketConn
  10. // net.Listener, but we can't have duplicate Close.
  11. Accept() (net.Conn, error)
  12. Addr() net.Addr
  13. // net.Dialer but there's no interface.
  14. DialContext(ctx context.Context, network, addr string) (net.Conn, error)
  15. // Dial(addr string) (net.Conn, error)
  16. }