Documentation ¶
Overview ¶
Objects package contains all the object types as defined in v3 of the protocol specifications. Specifically: message, broadcast, getpubkey, pubkey.
Index ¶
- Constants
- type BroadcastEncryptedV4
- type BroadcastEncryptedV5
- type BroadcastUnencryptedV4AddressV2
- type BroadcastUnencryptedV4AddressV3
- type BroadcastUnencryptedV5
- type Corrupt
- type EncodingType
- type GetpubkeyV3
- type GetpubkeyV4
- type MsgEncrypted
- type MsgUnencryptedV2
- func (obj *MsgUnencryptedV2) DeserializeReader(b io.Reader) error
- func (obj *MsgUnencryptedV2) Encrypt(key *elliptic.PublicKey) (types.Serializer, error)
- func (obj *MsgUnencryptedV2) Serialize() []byte
- func (obj *MsgUnencryptedV2) SetSignature(sig []byte)
- func (obj *MsgUnencryptedV2) SetSigningAndEncryptionKeys(sk, ek []byte)
- func (obj *MsgUnencryptedV2) SignatureSerialize() []byte
- type MsgUnencryptedV3
- func (obj *MsgUnencryptedV3) DeserializeReader(b io.Reader) error
- func (obj *MsgUnencryptedV3) Encrypt(key *elliptic.PublicKey) (types.Serializer, error)
- func (obj *MsgUnencryptedV3) Serialize() []byte
- func (obj *MsgUnencryptedV3) SetSignature(sig []byte)
- func (obj *MsgUnencryptedV3) SetSigningAndEncryptionKeys(sk, ek []byte)
- func (obj *MsgUnencryptedV3) SignatureSerialize() []byte
- type PubkeyEncryptedV4
- type PubkeyUnencryptedV4
- type PubkeyV2
- type PubkeyV3
- type Unrecognized
Constants ¶
const ( // Any data with this number may be ignored. The sending node might simply // be sharing its public key with you. Encoding_IGNORE = EncodingType(iota) // UTF-8. No 'Subject' or 'Body' sections. Useful for simple strings of // data, like URIs or magnet links. Encoding_TRIVIAL // UTF-8. Uses 'Subject' and 'Body' sections. No MIME is used. // messageToTransmit = 'Subject:' + subject + '\n' + 'Body:' + message Encoding_SIMPLE )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BroadcastEncryptedV4 ¶
type BroadcastEncryptedV4 struct { // Encrypted broadcast data. EncryptedData []byte }
Broadcast originating from an address version <= 3.
func (*BroadcastEncryptedV4) DeserializeReader ¶
func (obj *BroadcastEncryptedV4) DeserializeReader(b io.Reader) error
func (*BroadcastEncryptedV4) Serialize ¶
func (obj *BroadcastEncryptedV4) Serialize() []byte
type BroadcastEncryptedV5 ¶
type BroadcastEncryptedV5 struct { // The tag. This field is new and only included when the broadcast version // is >= 5. Tag [32]byte // Encrypted broadcast data. EncryptedData []byte }
Having a broadcast version of 5 indicates that a tag is used which, in turn, is used when the sender's address version is >=4.
func (*BroadcastEncryptedV5) DeserializeReader ¶
func (obj *BroadcastEncryptedV5) DeserializeReader(b io.Reader) error
func (*BroadcastEncryptedV5) Serialize ¶
func (obj *BroadcastEncryptedV5) Serialize() []byte
func (*BroadcastEncryptedV5) SetTag ¶
func (obj *BroadcastEncryptedV5) SetTag(tag []byte)
type BroadcastUnencryptedV4AddressV2 ¶
type BroadcastUnencryptedV4AddressV2 struct {
MsgUnencryptedV2
}
Broadcast version == 4 and address version == 2.
func (*BroadcastUnencryptedV4AddressV2) Encrypt ¶
func (obj *BroadcastUnencryptedV4AddressV2) Encrypt(key *elliptic.PublicKey) ( *BroadcastEncryptedV4, error)
type BroadcastUnencryptedV4AddressV3 ¶
type BroadcastUnencryptedV4AddressV3 struct {
MsgUnencryptedV3
}
Broadcast version == 4 and address version == 3.
func (*BroadcastUnencryptedV4AddressV3) Encrypt ¶
func (obj *BroadcastUnencryptedV4AddressV3) Encrypt(key *elliptic.PublicKey) ( *BroadcastEncryptedV4, error)
type BroadcastUnencryptedV5 ¶
type BroadcastUnencryptedV5 struct {
MsgUnencryptedV3
}
Broadcast version == 5 and address version == 4.
func (*BroadcastUnencryptedV5) Encrypt ¶
func (obj *BroadcastUnencryptedV5) Encrypt(key *elliptic.PublicKey) ( *BroadcastEncryptedV5, error)
type GetpubkeyV3 ¶
type GetpubkeyV3 struct { // The ripemd hash of the public key. This field is only included when the // address version is <= 3. Ripe [20]byte }
When a node has the hash of a public key (from a version <= 3 address) but not the public key itself, it must send out a request for the public key.
func (*GetpubkeyV3) DeserializeReader ¶
func (obj *GetpubkeyV3) DeserializeReader(b io.Reader) error
func (*GetpubkeyV3) Serialize ¶
func (obj *GetpubkeyV3) Serialize() []byte
type GetpubkeyV4 ¶
type GetpubkeyV4 struct { // The tag derived from the address version, stream number, and ripe. This // field is only included when the address version is >= 4. Tag [32]byte }
When a node has the hash of a public key (from a version >= 4 address) but not the public key itself, it must send out a request for the public key.
func (*GetpubkeyV4) DeserializeReader ¶
func (obj *GetpubkeyV4) DeserializeReader(b io.Reader) error
func (*GetpubkeyV4) Serialize ¶
func (obj *GetpubkeyV4) Serialize() []byte
type MsgEncrypted ¶
type MsgEncrypted struct {
EncryptedData []byte
}
Used for person-to-person messages.
func (*MsgEncrypted) DeserializeReader ¶
func (obj *MsgEncrypted) DeserializeReader(b io.Reader) error
func (*MsgEncrypted) Serialize ¶
func (obj *MsgEncrypted) Serialize() []byte
type MsgUnencryptedV2 ¶
type MsgUnencryptedV2 struct { // Sender's address version number. This is needed in order to calculate the // sender's address to show in the UI, and also to allow for forwards // compatible changes to the public-key data included below. AddressVersion types.Varint // The sender's stream number Stream types.Varint // A bitfield of optional behaviors and features that can be expected from // the node with this pubkey included in this message (the sender's pubkey). Behaviour uint32 // The ECC public key used for signing (uncompressed format; normally // prepended with \x04 ) PubSigningKey [64]byte // The ECC public key used for encryption (uncompressed format; normally // prepended with \x04 ) PubEncryptionKey [64]byte // The ripe hash of the public key of the receiver of the message. DestinationRipe [20]byte // Message Encoding type Encoding EncodingType // The message Message []byte // The acknowledgement data to be transmitted. This takes the form of a // Bitmessage protocol message, like another msg message. The POW therein // must already be completed. AckData []byte // The ECDSA signature which covers everything from the msg_version to the // ack_data. Signature []byte }
Used for person-to-person messages when the sender's address version <= 2.
func (*MsgUnencryptedV2) DeserializeReader ¶
func (obj *MsgUnencryptedV2) DeserializeReader(b io.Reader) error
func (*MsgUnencryptedV2) Encrypt ¶
func (obj *MsgUnencryptedV2) Encrypt(key *elliptic.PublicKey) (types.Serializer, error)
func (*MsgUnencryptedV2) Serialize ¶
func (obj *MsgUnencryptedV2) Serialize() []byte
func (*MsgUnencryptedV2) SetSignature ¶
func (obj *MsgUnencryptedV2) SetSignature(sig []byte)
func (*MsgUnencryptedV2) SetSigningAndEncryptionKeys ¶
func (obj *MsgUnencryptedV2) SetSigningAndEncryptionKeys(sk, ek []byte)
func (*MsgUnencryptedV2) SignatureSerialize ¶
func (obj *MsgUnencryptedV2) SignatureSerialize() []byte
Code taken from line 743 onwards on class_singleWorker.py
type MsgUnencryptedV3 ¶
type MsgUnencryptedV3 struct { // Sender's address version number. This is needed in order to calculate the // sender's address to show in the UI, and also to allow for forwards // compatible changes to the public-key data included below. AddressVersion types.Varint // The sender's stream number Stream types.Varint // A bitfield of optional behaviors and features that can be expected from // the node with this pubkey included in this message (the sender's pubkey). Behaviour uint32 // The ECC public key used for signing (uncompressed format; normally // prepended with \x04 ) PubSigningKey [64]byte // The ECC public key used for encryption (uncompressed format; normally // prepended with \x04 ) PubEncryptionKey [64]byte // Used to calculate the difficulty target of messages accepted by this // node. The higher this value, the more difficult the Proof of Work must be // before this individual will accept the message. This number is the // average number of nonce trials a node will have to perform to meet the // Proof of Work requirement. 1000 is the network minimum so any lower // values will be automatically raised to 1000. This field is new and is // only included when the address_version >= 3. NonceTrialsPerByte types.Varint // Used to calculate the difficulty target of messages accepted by this // node. The higher this value, the more difficult the Proof of Work must be // before this individual will accept the message. This number is added to // the data length to make sending small messages more difficult. 1000 is // the network minimum so any lower values will be automatically raised to // 1000. This field is new and is only included when the AddressVersion >= 3. ExtraBytes types.Varint // The ripe hash of the public key of the receiver of the message. DestinationRipe [20]byte // Message Encoding type Encoding EncodingType // The message Message []byte // The acknowledgement data to be transmitted. This takes the form of a // Bitmessage protocol message, like another msg message. The POW therein // must already be completed. AckData []byte // The ECDSA signature which covers everything from the msg_version to the // ack_data. Signature []byte }
Used for person-to-person messages when the sender's address version >= 3.
func (*MsgUnencryptedV3) DeserializeReader ¶
func (obj *MsgUnencryptedV3) DeserializeReader(b io.Reader) error
func (*MsgUnencryptedV3) Encrypt ¶
func (obj *MsgUnencryptedV3) Encrypt(key *elliptic.PublicKey) (types.Serializer, error)
func (*MsgUnencryptedV3) Serialize ¶
func (obj *MsgUnencryptedV3) Serialize() []byte
func (*MsgUnencryptedV3) SetSignature ¶
func (obj *MsgUnencryptedV3) SetSignature(sig []byte)
func (*MsgUnencryptedV3) SetSigningAndEncryptionKeys ¶
func (obj *MsgUnencryptedV3) SetSigningAndEncryptionKeys(sk, ek []byte)
func (*MsgUnencryptedV3) SignatureSerialize ¶
func (obj *MsgUnencryptedV3) SignatureSerialize() []byte
type PubkeyEncryptedV4 ¶
type PubkeyEncryptedV4 struct { // The tag, made up of bytes 32-64 of the double hash of the address data. Tag [32]byte // Encrypted pubkey data. EncryptedData []byte }
When version 4 pubkeys are created, most of the data in the pubkey is encrypted. This is done in such a way that only someone who has the Bitmessage address which corresponds to a pubkey can decrypt and use that pubkey. This prevents people from gathering pubkeys sent around the network and using the data from them to create messages to be used in spam or in flooding attacks.
func (*PubkeyEncryptedV4) Decrypt ¶
func (obj *PubkeyEncryptedV4) Decrypt(key *elliptic.PrivateKey) ( types.Serializer, error)
func (*PubkeyEncryptedV4) DeserializeReader ¶
func (obj *PubkeyEncryptedV4) DeserializeReader(b io.Reader) error
func (*PubkeyEncryptedV4) Serialize ¶
func (obj *PubkeyEncryptedV4) Serialize() []byte
func (*PubkeyEncryptedV4) SetTag ¶
func (obj *PubkeyEncryptedV4) SetTag(tag []byte)
type PubkeyUnencryptedV4 ¶
type PubkeyUnencryptedV4 struct {
PubkeyV3
}
When decrypted, a version 4 pubkey is the same as a verion 3 pubkey.
func (*PubkeyUnencryptedV4) Encrypt ¶
func (obj *PubkeyUnencryptedV4) Encrypt(key *elliptic.PublicKey) ( types.Serializer, error)
type PubkeyV2 ¶
type PubkeyV2 struct { // A bitfield of optional behaviors and features that can be expected from // the node receiving the message. Behaviour uint32 // The ECC public key used for signing (uncompressed format; normally // prepended with 0x04) PubSigningKey [64]byte // The ECC public key used for encryption (uncompressed format; normally // prepended with 0x04) PubEncryptionKey [64]byte }
A version 2 pubkey. This is still in use and supported by current clients but new v2 addresses are not generated by clients.
func (*PubkeyV2) SetSigningAndEncryptionKeys ¶
type PubkeyV3 ¶
type PubkeyV3 struct { // A bitfield of optional behaviors and features that can be expected from // the node receiving the message. Behaviour uint32 // The ECC public key used for signing (uncompressed format; normally // prepended with 0x04) PubSigningKey [64]byte // The ECC public key used for encryption (uncompressed format; normally // prepended with 0x04) PubEncryptionKey [64]byte // Used to calculate the difficulty target of messages accepted by this // node. The higher this value, the more difficult the Proof of Work must be // before this individual will accept the message. This number is the // average number of nonce trials a node will have to perform to meet the // Proof of Work requirement. 1000 is the network minimum so any lower // values will be automatically raised to 1000. NonceTrialsPerByte types.Varint // Used to calculate the difficulty target of messages accepted by this // node. The higher this value, the more difficult the Proof of Work must be // before this individual will accept the message. This number is added to // the data length to make sending small messages more difficult. 1000 is // the network minimum so any lower values will be automatically raised to // 1000. ExtraBytes types.Varint // The ECDSA signature which, as of protocol v3, covers the object header // starting with the time, appended with the data described in this table // down to the extra_bytes. Signature []byte }
A version 3 pubkey
func (*PubkeyV3) SetSignature ¶
func (*PubkeyV3) SetSigningAndEncryptionKeys ¶
func (*PubkeyV3) SignatureSerialize ¶
type Unrecognized ¶
type Unrecognized struct {
Data []byte
}
Unrecognized represents an unidentified object type.
func (*Unrecognized) DeserializeReader ¶
func (obj *Unrecognized) DeserializeReader(b io.Reader) error
func (*Unrecognized) Serialize ¶
func (obj *Unrecognized) Serialize() []byte