bencode

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package bencode provides encoding and decoding of data in the Bencode format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

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

Decode parses a bencoded byte slice and returns the decoded value as an interface or an error, if decoding fails.

func Encode added in v0.2.0

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

Encode encodes a value into a byte slice using bencode format. Supported types are string, int, slice, and map.

func Marshal added in v0.2.0

func Marshal(v any) ([]byte, error)

Marshal encodes the given value into a byte slice using with bencode format.

func Unmarshal

func Unmarshal(data []byte, v any) error

Unmarshal decodes bencoded data into the structure or variable provided by v, which must be a pointer.

Types

This section is empty.

Jump to

Keyboard shortcuts

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