2017-06-16 16:08:24 +08:00
|
|
|
package torrent
|
|
|
|
|
|
|
|
import (
|
2017-08-16 13:35:17 +08:00
|
|
|
"context"
|
2017-06-16 16:08:24 +08:00
|
|
|
"net"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Abstracts the utp Socket, so the implementation can be selected from
|
|
|
|
// different packages.
|
|
|
|
type utpSocket interface {
|
|
|
|
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)
|
2017-08-16 13:35:17 +08:00
|
|
|
DialContext(ctx context.Context, addr string) (net.Conn, error)
|
|
|
|
Dial(addr string) (net.Conn, error)
|
2017-06-16 16:08:24 +08:00
|
|
|
}
|