bencoding

package
v0.0.0-...-abf2807 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package bencoding implements the encoding used by bittorrent metadata and protocols.

See: https://www.bittorrent.org/beps/bep_0003.html#bencoding

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(input any) []byte

func MarshalDict

func MarshalDict(d map[string]any) []byte

func MarshalInt

func MarshalInt(i int) []byte

func MarshalList

func MarshalList[T string | int](l []T) []byte

func MarshalString

func MarshalString(s string) []byte

func Unmarshal

func Unmarshal(raw ByteReader) (result any, err error)

func UnmarshalDict

func UnmarshalDict(raw ByteReader) (map[string]any, error)

func UnmarshalInt

func UnmarshalInt(raw ByteReader) (int, error)

func UnmarshalList

func UnmarshalList(raw ByteReader) ([]any, error)

func UnmarshalString

func UnmarshalString(raw ByteReader) (string, error)

Types

type ByteReader

type ByteReader interface {
	ReadByte() (byte, error)
	UnreadByte() error
	Read([]byte) (int, error)
}

Jump to

Keyboard shortcuts

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