Documentation
¶
Overview ¶
Package structs implements types used in list exchange and storage on the server
Index ¶
Constants ¶
const ( // ExpireStructSize is the maximum size of an expirestruct when encoded // Expiretime 20 // MessageID 45 // Signer 90 // field sep 2 // --------------- // 157 ExpireStructSize = 157 // ExpireStructMin is the minimum size of an encoded expirestruct ExpireStructMin = 5 )
const ( // FetchListStructSize is the maximum size of an encoded FetchListStruct FetchListStructSize = 66 // messageID 45 + uint 8 + fieldsep // FetchListStructMin is the minimum size of a fetchlist struct FetchListStructMin = 3 )
const ( // MessageStructSize is the maximum size a message struct takes converted to byte/string // 10 field separators 10 // 5 * 20 bytes (uints) 100 // curve25519 -> 45 45 // base58 encoding is variable // messageID -> 45 45 // base58 encoding is variable // signerPub -> 90 90 // base58 encoding is variable // 3 * 5 bytes bools 15 // --------------------------- // 295 MessageStructSize = 274 // MessageStructMin Minimum size to start parsing MessageStructMin = 32 )
const ( // PeerStructSize is the maximum size of an encoded PeerStruct // Uints 20*4 100 // field sep 6 // ------------------ // 106 + AuthToken PeerStructSize = 106 + keyproof.ProofTokenSignedMax // PeerStructMin is the mimimum size of a peer struct PeerStructMin = 13 // PeerPubKeySize is the size of a peer's public key when encoded PeerPubKeySize = 44 )
const ( // SignerStructSize is the maximum size of a signer-struct represented as human-readable []byte // SignerpubKey 45 // base58 encoding is variable // Nonce 12 // base58 encoding is variable // Bits 3 // 5 * 20 100 // uints // 7 7 // field separators // ----------------------------------------- // 167 SignerStructSize = 167 // SignerStructMin is the minimum size SignerStructMin = 17 )
const Version = "0.0.1 very alpha"
Version of this release
Variables ¶
This section is empty.
Functions ¶
func BoolToString ¶
BoolToString converts a boolean into "true" or "false"
func StringToBool ¶
StringToBool converts "true"/"false" into boolean
Types ¶
type ExpireStruct ¶
type ExpireStruct struct { ExpireTime uint64 // When does the message expire MessageID [message.MessageIDSize]byte // The messageID SignerPubKey [message.SignerPubKeySize]byte // The Signer Pubkey }
ExpireStruct represents expire information for a message
func ExpireStructDecode ¶
func ExpireStructDecode(d ExpireStructEncoded) *ExpireStruct
ExpireStructDecode decodes an encoded ExpireStruct
func (ExpireStruct) Encode ¶
func (es ExpireStruct) Encode() ExpireStructEncoded
Encode an expireStruct
type ExpireStructEncoded ¶
type ExpireStructEncoded []byte
ExpireStructEncoded represents an encoded ExpireStruct
func (ExpireStructEncoded) Fill ¶
func (ese ExpireStructEncoded) Fill() ExpireStructEncoded
Fill fills an encoded messagestruct to maximum size
type FetchListStruct ¶
type FetchListStruct struct { MessageID [message.MessageIDSize]byte // The messageID TimeEntered uint64 }
FetchListStruct encodes data for the list of fetch jobs
func FetchListStructDecode ¶
func FetchListStructDecode(d FetchListStructEncoded) *FetchListStruct
FetchListStructDecode decodes human readable to struct
func (FetchListStruct) Encode ¶
func (fl FetchListStruct) Encode() FetchListStructEncoded
Encode a FetchListStruct to human readable format
type FetchListStructEncoded ¶
type FetchListStructEncoded []byte
FetchListStructEncoded represents an encoded FetchList
func (FetchListStructEncoded) Fill ¶
func (flse FetchListStructEncoded) Fill() FetchListStructEncoded
Fill fills an encoded FetchList to maximum size
type MessageStruct ¶
type MessageStruct struct { Counter uint64 // is zero unless from a list PostTime uint64 // When was the message posted ExpireTime uint64 // When does the message expire. Calculate from ExpireRequest ExpireRequest uint64 // Requested expire time MessageID [message.MessageIDSize]byte // The messageID ReceiverConstantPubKey message.Curve25519Key // The ReceiverConstantPubKey SignerPub [message.SignerPubKeySize]byte // The Signer Pubkey Distance uint64 // The distance to origin. Increased by one when fetching OneTime bool // Mark message as one-time. Message is deleted on fetch Sync bool // Message will be synced (0x00==no,0x01==yes) Hidden bool // Message is hidden (0x00==no,0x01==yes) }
MessageStruct describes a message
func MessageStructDecode ¶
func MessageStructDecode(d MessageStructEncoded) *MessageStruct
MessageStructDecode decodes bytes to MessageStruct
func (MessageStruct) Encode ¶
func (ms MessageStruct) Encode() MessageStructEncoded
Encode encodes a MessageStruct in human-readable format for storage
type MessageStructEncoded ¶
type MessageStructEncoded []byte
MessageStructEncoded represents an encoded MessageStruct
func (MessageStructEncoded) Fill ¶
func (mse MessageStructEncoded) Fill() MessageStructEncoded
Fill fills an encoded messagestruct to maximum size
type PeerStruct ¶
type PeerStruct struct { AuthToken [keyproof.ProofTokenSignedSize]byte // Keyproof token, countersigned LastNotifySend uint64 // When did we send a notify last LastNotifyFrom uint64 // When did we receive a notify last LastFetch uint64 // When did we last fetch from this peer ErrorCount uint64 // Number of errors occured LastPosition uint64 // Last successful position in download }
PeerStruct represents a peer
func PeerStructDecode ¶
func PeerStructDecode(d PeerStructEncoded) *PeerStruct
PeerStructDecode decodes an encoded peer struct
func (PeerStruct) Encode ¶
func (ps PeerStruct) Encode() PeerStructEncoded
Encode peerstruct into human readable form
type PeerStructEncoded ¶
type PeerStructEncoded []byte
PeerStructEncoded represents an encoded PeerStruct
func (PeerStructEncoded) Fill ¶
func (pse PeerStructEncoded) Fill() PeerStructEncoded
Fill fills an encoded peerstruct to maximum size
type SignerStruct ¶
type SignerStruct struct { PublicKey [message.SignerPubKeySize]byte // Public key of signer Nonce [hashcash.NonceSize]byte // HashCash nonce Bits byte // Hashcash bits. Verified MessagesPosted uint64 // Total messages posted, always increment MessagesRetained uint64 // Messages retained MaxMessagesPosted uint64 // Maximum messages that may be posted MaxMessagesRetained uint64 // Maximum messages that may be retained ExpireTarget uint64 // Calculated from Bits }
SignerStruct describes a signer
func SignerStructDecode ¶
func SignerStructDecode(d SignerStructEncoded) *SignerStruct
SignerStructDecode decodes an encoded signerstruct
func (SignerStruct) Encode ¶
func (ss SignerStruct) Encode() SignerStructEncoded
Encode a SignerStruct to human readable representation
type SignerStructEncoded ¶
type SignerStructEncoded []byte
SignerStructEncoded represents an encoded SignerStruct
func (SignerStructEncoded) Fill ¶
func (sse SignerStructEncoded) Fill() SignerStructEncoded
Fill fills an encoded Signerstruct to maximum size