Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidInfoData = errors.New("storage: invalid info data")
ErrInvalidInfoData is the error returned when invalid info data provided.
View Source
var ErrInvalidPeerData = errors.New("storage: invalid peer data")
ErrInvalidPeerData is the error returned when invalid peer data provided.
View Source
var ErrTorrentNotFound = errors.New("storage: torrent not found")
ErrTorrentNotFound is the error returned when torrent not found.
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct { Hash []byte // 20 bytes Incomplete uint32 Complete uint32 Downloaded uint32 Name []byte }
Info torrent info struct
type Peer ¶
type Peer struct { ID []byte // 20 bytes Uploaded uint64 Downloaded uint64 Left uint64 IP []byte // 4 bytes Port uint16 Key []byte LastUpdate time.Time }
Peer info struct
type Storage ¶
type Storage interface { // GetInfo returns torrent info by infoHash. GetInfo([]byte) (*Info, error) // SetInfo store torrent info. SetInfo(*Info) error // SetPeer store peer identified by infoHash. SetPeer([]byte, *Peer) error // GetActivePeers returns active peers for torrent by infoHash. GetActivePeers([]byte) ([]*Peer, error) }
Storage interface
Click to show internal directories.
Click to hide internal directories.