Documentation ¶
Index ¶
- Constants
- type BencodingDecoder
- func (d *BencodingDecoder) Decode() (map[string]any, error)
- func (d *BencodingDecoder) DecodeDict() (value map[string]any, err error)
- func (d *BencodingDecoder) DecodeInt() (value int, err error)
- func (d *BencodingDecoder) DecodeList() (value []any, err error)
- func (d *BencodingDecoder) DecodeString() (value string, err error)
- type BencodingEncoder
- type Client
- type HandShakePayLoad
- type Info
- type Mapable
- type MetaInfoFile
- type MultiFiles
Constants ¶
View Source
const ( BitTorrentIdentifier = "BitTorrent protocol" BazPeerID = "BazeengaBitTorrent24" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BencodingDecoder ¶
type BencodingDecoder struct {
// contains filtered or unexported fields
}
func NewDecoder ¶
func NewDecoder(r io.Reader) *BencodingDecoder
func (*BencodingDecoder) DecodeDict ¶
func (d *BencodingDecoder) DecodeDict() (value map[string]any, err error)
func (*BencodingDecoder) DecodeInt ¶
func (d *BencodingDecoder) DecodeInt() (value int, err error)
func (*BencodingDecoder) DecodeList ¶
func (d *BencodingDecoder) DecodeList() (value []any, err error)
func (*BencodingDecoder) DecodeString ¶
func (d *BencodingDecoder) DecodeString() (value string, err error)
type BencodingEncoder ¶
type BencodingEncoder struct {
EncodedData string
}
func (*BencodingEncoder) Encode ¶
func (e *BencodingEncoder) Encode(decoded Mapable)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) Init ¶
func (c *Client) Init(metaInfoFile MetaInfoFile)
func (*Client) SendConnectRequest ¶
func (c *Client) SendConnectRequest()
type HandShakePayLoad ¶
type HandShakePayLoad struct {
// contains filtered or unexported fields
}
type Info ¶
type Info struct { PieceLength int `json:"piece length"` // common Pieces string `json:"pieces"` // common Private int `json:"private"` // common optional Name string `json:"name"` // common Length int `json:"length"` // single-file Md5sum string `json:"md5sum"` // single-file optional Files []MultiFiles `json:"files"` }
func (Info) UnMarshallToDict ¶
type MetaInfoFile ¶
type MetaInfoFile struct { Announce string `json:"announce"` Info Info `json:"info"` AnnounceList [][]string `json:"announce-list"` // optional CreationDate int `json:"creation date"` // optional Comment string `json:"comment"` // optional CreatedBy string `json:"created by"` // optional Encoding string `json:"encoding"` // optional }
func (*MetaInfoFile) HostDetails ¶
func (metainfofile *MetaInfoFile) HostDetails() []*url.URL
func (MetaInfoFile) InfoHash ¶
func (metainfofile MetaInfoFile) InfoHash() [20]byte
func (*MetaInfoFile) UnMarshalFile ¶
func (metainfofile *MetaInfoFile) UnMarshalFile(filename string)
func (MetaInfoFile) UnMarshallToDict ¶
func (metainfofile MetaInfoFile) UnMarshallToDict() (ret map[string]any)
type MultiFiles ¶
Click to show internal directories.
Click to hide internal directories.