webtorrent

package
v1.9.7 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InfoHash

func InfoHash(share string) string

func NewClient

func NewClient(tracker, share, pwd string, pc *pion.PeerConnection) (*webrtc.Conn, error)

Types

type Cipher

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

func NewCipher

func NewCipher(share, pwd, nonce string) (*Cipher, error)

func (*Cipher) Decrypt

func (c *Cipher) Decrypt(ciphertext []byte) ([]byte, error)

func (*Cipher) Encrypt

func (c *Cipher) Encrypt(plaintext []byte) []byte

type Message

type Message struct {
	Action   string `json:"action"`
	InfoHash string `json:"info_hash"`

	// Announce msg
	Numwant int    `json:"numwant,omitempty"`
	PeerId  string `json:"peer_id,omitempty"`
	Offers  []struct {
		OfferId string `json:"offer_id"`
		Offer   struct {
			Type string `json:"type"`
			SDP  string `json:"sdp"`
		} `json:"offer"`
	} `json:"offers,omitempty"`

	// Interval msg
	Interval   int `json:"interval,omitempty"`
	Complete   int `json:"complete,omitempty"`
	Incomplete int `json:"incomplete,omitempty"`

	// Offer msg
	OfferId string `json:"offer_id,omitempty"`
	Offer   *struct {
		Type string `json:"type"`
		SDP  string `json:"sdp"`
	} `json:"offer,omitempty"`

	// Answer msg
	ToPeerId string `json:"to_peer_id,omitempty"`
	Answer   *struct {
		Type string `json:"type"`
		SDP  string `json:"sdp"`
	} `json:"answer,omitempty"`
}

type Server

type Server struct {
	core.Listener

	URL      string
	Exchange func(src, offer string) (answer string, err error)
	// contains filtered or unexported fields
}

func (*Server) AddShare

func (s *Server) AddShare(name, pwd, src string)

func (*Server) GetSharePwd

func (s *Server) GetSharePwd(name string) (pwd string)

func (*Server) HasShares

func (s *Server) HasShares() bool

func (*Server) RemoveShare

func (s *Server) RemoveShare(name string)

func (*Server) Serve

func (s *Server) Serve() error

Serve - run reconnection loop, will exit on??

type Share

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

Jump to

Keyboard shortcuts

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