Simplify the utpSocket interface definition
This commit is contained in:
parent
54f43419e2
commit
f4c03ee6ac
11
utp.go
11
utp.go
|
@ -3,21 +3,16 @@ package torrent
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"net"
|
"net"
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Abstracts the utp Socket, so the implementation can be selected from
|
// Abstracts the utp Socket, so the implementation can be selected from
|
||||||
// different packages.
|
// different packages.
|
||||||
type utpSocket interface {
|
type utpSocket interface {
|
||||||
|
net.PacketConn
|
||||||
|
// net.Listener, but we can't have duplicate Close.
|
||||||
Accept() (net.Conn, error)
|
Accept() (net.Conn, error)
|
||||||
Addr() net.Addr
|
Addr() net.Addr
|
||||||
Close() error
|
// net.Dialer but there's no interface.
|
||||||
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)
|
|
||||||
DialContext(ctx context.Context, addr string) (net.Conn, error)
|
DialContext(ctx context.Context, addr string) (net.Conn, error)
|
||||||
Dial(addr string) (net.Conn, error)
|
Dial(addr string) (net.Conn, error)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue