bencode

package
v0.0.0-...-640c710 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2017 License: MIT Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeByteString

func EncodeByteString(key string) string

EncodeByteString Encodes a string to <key length>:<key>

func EncodeDictionary

func EncodeDictionary(kvpairs []string) (retdict string)

EncodeDictionary Takes a list of bencoded KVpairs and return a bencoded dictionary.

func EncodeInt

func EncodeInt(x int) string

EncodeInt encodes an int to a bencoded integer: "i<x>e"

func EncodeKV

func EncodeKV(key string, value string) string

EncodeKV Encodes a KV pair into a string

func EncodeList

func EncodeList(items []string) string

EncodeList encodes a list of items (`items`) to a bencoded list: "l<item1><item2><...><itemN>e"

func EncodePeerList

func EncodePeerList(peers []string) (retlist string)

EncodePeerList Handles peer list creation for non-compact responses. Mostly deprecated for most torrent clients nowadays as compact is the default. Returns a bencoded list of bencoded dictionaries containing "peer id", "ip", "port": "ld7:peer id20:<peer id>2:ip9:<127.0.0.1>4:port4:7878ee" peers contains a ip:port

Types

This section is empty.

Jump to

Keyboard shortcuts

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