p2plib library

Classes

AddressProperties
Represents properties associated with a network address.
Crypto
Provides cryptographic functionalities for encrypting, decrypting, signing, and verifying data.
FullAddress
Message
Message Structure:
Packet
Packet Structure:
PacketHeader
Structure of a packet header:
PeerId
A Peer ID is a 64-byte value composed of two 32-byte keys:
Route
Represents a route to a peer in the network.
RouterBase
Abstract base class for network routers.
RouterL0
Basic router implementation for relaying and forwarding datagrams.
RouterL1
Enhanced router with confirmation and keepalive features.
RouterL2
Enhanced router with more high-level API for building rich client applications.
RouterL3
Router implementation for Layer 3 (Network Layer).
Token
TransportBase
Base class for all transport implementations.
TransportUdp
A UDP transport implementation.
Uint8List
A fixed-length list of 8-bit unsigned integers.

Enums

PacketType
Represents the type of packet.
TaskType

Constants

sealLength → const int
signatureLength → const int

Properties

emptyUint8List Uint8List
final

Functions

genRandomInt() int
Generates a random integer using a cryptographically secure random number generator.
getRandomBytes(int length) Uint8List
Generates a list of random bytes of the specified length.

Typedefs

InitRequest = ({Uint8List? seed, SendPort sendPort})
InitResponse = ({Uint8List encPubKey, Uint8List seed, SendPort sendPort, Uint8List signPubKey})
InitResult = ({Uint8List encPubKey, Uint8List seed, Uint8List signPubKey})
PeerStatus = ({bool isOnline, PeerId peerId})
TaskError = ({Object error, int id})
TaskRequest = ({Uint8List datagram, int id, TaskType type})
TaskResult = ({Uint8List datagram, int id})

Exceptions / Errors

ExceptionBase
Base class for all exceptions thrown by this library.
ExceptionInvalidSignature
Exception indicating that an invalid signature was detected.
ExceptionInvalidTimestamp
Exception indicating that an invalid timestamp was detected.
ExceptionIsNotRunning
Exception indicating that an operation was attempted on a router that is not currently running.
ExceptionTransport
Exception indicating an error related to the transport layer.
ExceptionUnknownRoute
Exception indicating that an unknown route was encountered.
StopProcessing
Exception indicating that processing should be stopped immediately.