bencode

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

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

Go to latest
Published: Apr 13, 2020 License: MIT Imports: 4 Imported by: 0

README

go-bencode

go bencode encode/decode library

Documentation

Index

Constants

View Source
const (
	DigitLow        = byte('0')
	DigitHigh       = byte('9')
	IntegerStart    = byte('i')
	IntegerEnd      = byte('e')
	ListStart       = byte('l')
	ListEnd         = byte('e')
	DictionaryStart = byte('d')
	DictionaryEnd   = byte('e')
)

Variables

View Source
var ErrBadEncoding = errors.New("bad encoding")
View Source
var ErrInvalidInput = errors.New("invalid input")
View Source
var ErrUnsupportedType = errors.New("unsupported type")
View Source
var StringDelimiter = []byte(":")

Functions

func Decode

func Decode(data []byte) (interface{}, error)

Decode will return either string, int64, []interface{} or map[string]interface{}, interface{} being anything of these 4 types

func Encode

func Encode(value interface{}) ([]byte, error)

Encode accepts either string/[]byte, int/int8/int16/int32/int64, []interface{} or map[string]interface{}, interface{} being anything from mentioned types TODO: consider using io.Writer and writing directly to it

Types

This section is empty.

Jump to

Keyboard shortcuts

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