bencode

package module
v0.0.0-...-daf39f1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: MIT Imports: 3 Imported by: 0

README

bencode

Bencode package dedicated in torrent file written in go.

Documentation

Index

Constants

View Source
const (
	NULL = iota
	DICT
	LIST
	INT
	STRING

	MaxDepth = 100
)

Bencode types.

Variables

View Source
var (
	ErrMaxDepth            = errors.New("stack overflow")
	ErrDicWithNonStringKey = errors.New("dictionary's key must be a byte string")
)

Some vars.

Functions

This section is empty.

Types

type B

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

B illustrates a bencode struct.

func Decode

func Decode(body []byte) (B, error)

Decode decodes B values from an input []byte.

func (*B) Print

func (b *B) Print()

Print B

type Decoder

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

A Decoder reads and decodes B values from an input stream.

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

NewDecoder news a Decoder from given io.Reader.

func (*Decoder) Decode

func (d *Decoder) Decode() (b B, e error)

Decode decodes B values from *Decoder.

type Encoder

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

An Encoder writes B values to an output stream.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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