Documentation ¶
Overview ¶
Package message is used to create network messages for the purpose of confirming integrity and proof of work.
The main purpose of the message is the possibility of retransmission with verification by the network key and hide the structure of the true message.
NETWORK MESSAGE FORMAT Sc || Sa || E( KDF(K,Sc), P(HLMV) || HLMV || LM || M || V ) where HLMV = H( KDF(K,Sa), LM || M || V ) LM = L(M) Sc = G(N) Sa = G(N) where KDF - key derivation function H - hmac K - network key Sa - auth salt M - message bytes L - length G - prng Sc - cipher salt P - proof of work E - encrypt V - void bytes N - num random bytes Scheme: https://github.com/number571/go-peer/blob/master/images/go-peer_layer1_net_message.jpg
Index ¶
Constants ¶
View Source
const ( CMessageHeadSize = 2*cSaltSize + symmetric.CAESBlockSize + hashing.CSHA256Size + 3*encoding.CSizeUint64 )
Variables ¶
View Source
var ( ErrUnknownType = &SMessageError{"unknown type"} ErrInvalidHeaderSize = &SMessageError{"length of message bytes < size of header"} ErrInvalidProofOfWork = &SMessageError{"got invalid proof of work"} ErrInvalidPayloadSize = &SMessageError{"got invalid payload size"} ErrInvalidAuthHash = &SMessageError{"got invalid auth hash"} ErrDecodePayload = &SMessageError{"decode payload"} )
Functions ¶
This section is empty.
Types ¶
type IMessage ¶
type IMessage interface { types.IConverter GetHash() []byte GetVoid() []byte GetSalt() [2][]byte GetProof() uint64 GetPayload() payload.IPayload }
func LoadMessage ¶
type ISettings ¶ added in v1.5.21
func NewSettings ¶ added in v1.5.21
type SMessageError ¶ added in v1.6.8
type SMessageError struct {
// contains filtered or unexported fields
}
func (*SMessageError) Error ¶ added in v1.6.8
func (err *SMessageError) Error() string
Click to show internal directories.
Click to hide internal directories.