webtorrent

package
v0.0.0-...-9e09347 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2022 License: MIT, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnounceRequest

type AnnounceRequest struct {
	Numwant    int     `json:"numwant"`
	Uploaded   int64   `json:"uploaded"`
	Downloaded int64   `json:"downloaded"`
	Left       int64   `json:"left"`
	Action     string  `json:"action"`
	InfoHash   string  `json:"info_hash"`
	PeerID     string  `json:"peer_id"`
	Offers     []Offer `json:"offers"`
}

type AnnounceResponse

type AnnounceResponse struct {
	InfoHash   string                     `json:"info_hash"`
	Action     string                     `json:"action"`
	Interval   *int                       `json:"interval,omitempty"`
	Complete   *int                       `json:"complete,omitempty"`
	Incomplete *int                       `json:"incomplete,omitempty"`
	PeerID     string                     `json:"peer_id,omitempty"`
	ToPeerID   string                     `json:"to_peer_id,omitempty"`
	Answer     *webrtc.SessionDescription `json:"answer,omitempty"`
	Offer      *webrtc.SessionDescription `json:"offer,omitempty"`
	OfferID    string                     `json:"offer_id,omitempty"`
}

type DataChannelContext

type DataChannelContext struct {
	// Can these be obtained by just calling the relevant methods on peerConnection?
	Local, Remote webrtc.SessionDescription
	PeerID        string
	OfferId       string
	LocalOffered  bool
	// contains filtered or unexported fields
}

func (*DataChannelContext) GetSelectedIceCandidatePair

func (me *DataChannelContext) GetSelectedIceCandidatePair() (*webrtc.ICECandidatePair, error)

type Offer

type Offer struct {
	OfferID string                    `json:"offer_id"`
	Offer   webrtc.SessionDescription `json:"offer"`
}

type TrackerClient

type TrackerClient struct {
	NumWant  int
	Url      string
	PeerId   string
	InfoHash string
	OnConn   onDataChannelOpen
	Logger   log.Logger
	Dialer   *websocket.Dialer
	// contains filtered or unexported fields
}

Client represents the webtorrent client

func (*TrackerClient) Announce

func (tc *TrackerClient) Announce() error

func (*TrackerClient) Close

func (tc *TrackerClient) Close() error

func (*TrackerClient) Start

func (tc *TrackerClient) Start(onStop func(error))

Finishes initialization and spawns the run routine, calling onStop when it completes with the result. We don't let the caller just spawn the runner directly, since then we can race against .Close to finish initialization.

func (*TrackerClient) Stats

func (tc *TrackerClient) Stats() TrackerClientStats

type TrackerClientStats

type TrackerClientStats struct {
	Dials                  int64
	ConvertedInboundConns  int64
	ConvertedOutboundConns int64
}

Jump to

Keyboard shortcuts

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