package
0.0.0-20240503093246-678d81269f95
Repository: https://github.com/newinfooffical/core.git
Documentation: pkg.go.dev

# README

Protocol

The Peernet Protocol is defined in the Whitepaper and implemented here accordingly.

# Functions

BlockTransferReadBlock reads the header and the block from the reader.
BlockTransferWriteHeader starts writing the header for a block transfer.
DecodeAnnouncement decodes the incoming announcement message.
DecodeGetBlock decodes a Get Block message.
DecodeResponse decodes the incoming response message.
DecodeTransfer decodes a transfer message.
DecodeTraverse decodes a traverse message.
EncodeAnnouncement encodes an announcement message.
EncodeGetBlock encodes a Get Block message.
EncodeResponse encodes a response message hash2Peers will be modified.
EncodeTransfer encodes a transfer message.
EncodeTraverse encodes a traverse message.
EncodeTraverseSetAddress sets the IP and Port in a traverse message that shall be forwarded to another peer.
FileTransferReadHeader starts reading the header for a file transfer.
FileTransferWriteHeader starts writing the header for a file transfer.
HashData abstracts the hash function.
Creates a new manager to keep track of accepted IDs.
NewSequenceManager creates a new sequence manager.
PacketDecrypt decrypts the packet, verifies its signature and returns a high-level version of the packet.
PacketEncrypt encrypts a packet using the provided senders private key and receivers compressed public key.
Encodes a lite packet.
PublicKey2NodeID translates the Public Key into the node ID used in the Kademlia network.

# Constants

FIND_PEER Request closest neighbors to target peer.
FIND_SELF Request closest neighbors to self.
FIND_VALUE Request data or closest peers.
INFO_STORE Sender indicates storing provided data.
SEQUENCE_LAST Last response to the announcement in the sequence.
Announcement.
Chat message [debug].
Request blocks for specified peer.
Local discovery.
Keep-alive message (no payload).
Response to ping (no payload).
Response.
File transfer.
Help establish a connection between 2 remote peers.
EmbeddedFileSizeMax is the maximum size of embedded files in response messages.
Sender indicates a potential firewall.
Sender listens on IPv4.
Sender listens on IPv6.
Active block transfer.
Requested blockchain has 0 blocks.
Requested blockchain not available (not found).
Request start transfer of blocks.
Terminate.
No description provided by the author
No description provided by the author
No description provided by the author
HashSize is blake3 hash digest size = 256 bits.
The minimum packet size is 12 bytes (minimum header size) + 65 bytes (signature).
Minimum packet size of lite packets.
ProtocolVersion is the current protocol version.
Active file transfer.
Requested file not available.
Request start transfer of file.
Terminate.
TransferMaxEmbedSize is a recommended default upper size of embedded data inside the Transfer message, to be used as MaxPacketSize limit in the embedded protocol.
Same as TransferMaxEmbedSize but for encoding via lite packets.
UDT via lite packets.

# Structs

BlockRange is a single start-count range.
EmbeddedFileData contains embedded data sent within a response.
Hash2Peer links a hash to peers who are known to store the data and to peers who are considered close to the hash.
InfoStore informs about files stored.
KeyHash is a single blake3 key hash.
LiteID contains session information for a bidirectional transfer of data.
LiteRouter keeps track of accepted (expected) packet IDs.
MessageAnnouncement is the decoded announcement message.
MessageGetBlock is the decoded Get Block message.
MessageRaw is a high-level message between peers that has not been decoded.
MessageResponse is the decoded response message.
MessageTransfer is the decoded transfer message.
MessageTraverse is the decoded traverse message.
PacketLiteRaw is a decrypted P2P lite packet.
PacketRaw is a decrypted P2P message.
PeerRecord informs about a peer.
SequenceExpiry contains the decoded sequence information of a message.
SequenceManager stores all message sequence numbers that are valid at the moment.