]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Simplify the utpSocket interface definition
authorMatt Joiner <anacrolix@gmail.com>
Mon, 5 Feb 2018 07:03:27 +0000 (18:03 +1100)
committerMatt Joiner <anacrolix@gmail.com>
Mon, 5 Feb 2018 07:03:27 +0000 (18:03 +1100)
utp.go

diff --git a/utp.go b/utp.go
index 1d395e8068a719b03f980581b863f156135a2015..aafd574e0b320e6d4a68c20f38bc235862f06a78 100644 (file)
--- a/utp.go
+++ b/utp.go
@@ -3,21 +3,16 @@ package torrent
 import (
        "context"
        "net"
-       "time"
 )
 
 // Abstracts the utp Socket, so the implementation can be selected from
 // different packages.
 type utpSocket interface {
+       net.PacketConn
+       // net.Listener, but we can't have duplicate Close.
        Accept() (net.Conn, error)
        Addr() net.Addr
-       Close() error
-       LocalAddr() net.Addr
-       ReadFrom([]byte) (int, net.Addr, error)
-       SetDeadline(time.Time) error
-       SetWriteDeadline(time.Time) error
-       SetReadDeadline(time.Time) error
-       WriteTo([]byte, net.Addr) (int, error)
+       // net.Dialer but there's no interface.
        DialContext(ctx context.Context, addr string) (net.Conn, error)
        Dial(addr string) (net.Conn, error)
 }