KeyDesc

class KeyDesc(val name: String, val type: BdecodeNode.Type, val size: Int = 0, val flags: Int = 0)

A single required or optional key in a DHT message schema. This is the port of struct key_desc_t (include/libtorrent/kademlia/msg.hpp). Together with verifyMessage this reproduces libtorrent's verify_message_impl (src/kademlia/msg.cpp): a table of these describes the keys a query/response must contain, their bencode type, optional exact size constraints, and nesting flags.

Constructors

Link copied to clipboard
constructor(name: String, type: BdecodeNode.Type, size: Int = 0, flags: Int = 0)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard

The dictionary key to look up.

Link copied to clipboard
val size: Int

Required string length (only checked for BdecodeNode.Type.STRING); 0 means "no length constraint". With SIZE_DIVISIBLE the length must instead be a multiple of this.

Link copied to clipboard

Required bencode type, or BdecodeNode.Type.NONE to accept any type.