announce

package
v0.0.0-...-8cd3384 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2021 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ANNOUNCEURLKIND_DHT  = iota
	ANNOUNCEURLKIND_UDP  = iota
	ANNOUNCEURLKIND_HTTP = iota
)

Variables

View Source
var (
	ERR_ANNOUNCEURL    = errors.New("ERR_ANNOUNCEURL")
	ERR_QUERY_ANNOUNCE = errors.New("ERR_QUERY_ANNOUNCE")
)

Functions

This section is empty.

Types

type AnnounceHandshakeParams

type AnnounceHandshakeParams struct {
	InfoHash   string
	PeerId     string
	Port       string
	Uploaded   string
	Downloaded string
	Left       string
	Event      string
}

func GetAnnounceHandshakeParams

func GetAnnounceHandshakeParams(myMetainfo *metainfo.MetaInfo, myPeerId [20]byte) (AnnounceHandshakeParams, error)

type AnnounceUrl

type AnnounceUrl struct {
	// contains filtered or unexported fields
}

func NewAnnounceUrl

func NewAnnounceUrl(url string) (*AnnounceUrl, error)

type AnnounceUrlResponse

type AnnounceUrlResponse struct {
	FailureReason string     `bencode:"failure reason"`
	Interval      int32      `bencode:"interval"`
	TrackerId     string     `bencode:"tracker id"`
	Complete      int32      `bencode:"complete"`
	Incomplete    int32      `bencode:"incomplete"`
	Peers         peer.Peers `bencode:"peers"`
}

func GetPeers

func GetPeers(myMetainfo *metainfo.MetaInfo, myPeerId [20]byte) (*AnnounceUrlResponse, error)

func QueryAnnounceUrls

func QueryAnnounceUrls(announceUrls []string,
	handshakeParams AnnounceHandshakeParams) (*AnnounceUrlResponse, error)

QueryAnnounceUrls takes 'announceUrls' and queries them with 'handshakeParams' synchronously until one responds. If we get one good response, it is decoded (through bencode), marshalled and returned

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL