Versions in this module Expand all Collapse all v0 v0.2.1 Mar 4, 2015 Changes in this version + const CmdAddr + const CmdAlert + const CmdBlock + const CmdCommitChain + const CmdCommitEntry + const CmdConfirmation + const CmdDirectoryBlock + const CmdEntry + const CmdEntryBlock + const CmdEntryCreditBlock + const CmdFilterAdd + const CmdFilterClear + const CmdFilterLoad + const CmdGetAddr + const CmdGetData + const CmdGetDirBlocks + const CmdGetHeaders + const CmdHeaders + const CmdInv + const CmdMHashReveal + const CmdMemPool + const CmdMerkleBlock + const CmdNotFound + const CmdPing + const CmdPong + const CmdReject + const CmdRevealChain + const CmdRevealEntry + const CmdTx + const CmdVerAck + const CmdVersion + const CommandSize + const DefaultUserAgent + const HashSize + const MaxAddrPerMsg + const MaxAppMsgPayload + const MaxBlockLocatorsPerMsg + const MaxBlockPayload + const MaxHashStringSize + const MaxInvPerMsg + const MaxMessagePayload + const MaxUserAgentLen + const MaxVarIntPayload + const MessageHeaderSize + const MultipleAddressVersion + const NetAddressTimeVersion + const ProtocolVersion + const RejectVersion + var ErrHashStrSize = fmt.Errorf("max hash string length is %v bytes", MaxHashStringSize) + var ErrInvalidNetAddr = errors.New("provided net.Addr is not a net.TCPAddr") + func DoubleSha256(b []byte) []byte + func RandomUint64() (uint64, error) + func VarIntSerializeSize(val uint64) int + func WriteMessage(w io.Writer, msg Message, pver uint32, btcnet FactomNet) error + func WriteMessageN(w io.Writer, msg Message, pver uint32, btcnet FactomNet) (int, error) + type Alert struct + Cancel int32 + Comment string + Expiration int64 + ID int32 + MaxVer int32 + MinVer int32 + Priority int32 + RelayUntil int64 + Reserved string + SetCancel []int32 + SetSubVer []string + StatusBar string + Version int32 + func NewAlert(version int32, relayUntil int64, expiration int64, id int32, cancel int32, ...) *Alert + func NewAlertFromPayload(serializedPayload []byte, pver uint32) (*Alert, error) + func (alert *Alert) Deserialize(r io.Reader, pver uint32) error + func (alert *Alert) Serialize(w io.Writer, pver uint32) error + type FactomNet uint32 + const MainNet + const SimNet + const TestNet + const TestNet3 + func (n FactomNet) String() string + type InvType uint32 + const InvTypeError + const InvTypeFactomControl + const InvTypeFactomDirBlock + const InvTypeFactomEntry + const InvTypeFactomEntryBlock + const InvTypeFactomRaw + const InvTypeTx + func (invtype InvType) String() string + type InvVect struct + Hash ShaHash + Type InvType + func NewInvVect(typ InvType, hash *ShaHash) *InvVect + type Message interface + BtcDecode func(io.Reader, uint32) error + BtcEncode func(io.Writer, uint32) error + Command func() string + MaxPayloadLength func(uint32) uint32 + func ReadMessage(r io.Reader, pver uint32, btcnet FactomNet) (Message, []byte, error) + func ReadMessageN(r io.Reader, pver uint32, btcnet FactomNet) (int, Message, []byte, error) + type MessageError struct + Description string + Func string + func (e *MessageError) Error() string + type MsgAddr struct + AddrList []*NetAddress + func NewMsgAddr() *MsgAddr + func (msg *MsgAddr) AddAddress(na *NetAddress) error + func (msg *MsgAddr) AddAddresses(netAddrs ...*NetAddress) error + func (msg *MsgAddr) BtcDecode(r io.Reader, pver uint32) error + func (msg *MsgAddr) BtcEncode(w io.Writer, pver uint32) error + func (msg *MsgAddr) ClearAddresses() + func (msg *MsgAddr) Command() string + func (msg *MsgAddr) MaxPayloadLength(pver uint32) uint32 + type MsgAlert struct + Payload *Alert + SerializedPayload []byte + Signature []byte + func NewMsgAlert(serializedPayload []byte, signature []byte) *MsgAlert + func (msg *MsgAlert) BtcDecode(r io.Reader, pver uint32) error + func (msg *MsgAlert) BtcEncode(w io.Writer, pver uint32) error + func (msg *MsgAlert) Command() string + func (msg *MsgAlert) MaxPayloadLength(pver uint32) uint32 + type MsgCommitChain struct + ChainID *notaryapi.Hash + Credits uint32 + ECPubKey *notaryapi.Hash + EntryChainIDHash *notaryapi.Hash + EntryHash *notaryapi.Hash + Sig []byte + Timestamp uint64 + func NewMsgCommitChain() *MsgCommitChain + func (msg *MsgCommitChain) BtcDecode(r io.Reader, pver uint32) error + func (msg *MsgCommitChain) BtcEncode(w io.Writer, pver uint32) error + func (msg *MsgCommitChain) Command() string + func (msg *MsgCommitChain) MaxPayloadLength(pver uint32) uint32 + type MsgCommitEntry struct + Credits uint32 + ECPubKey *notaryapi.Hash + EntryHash *notaryapi.Hash + Sig []byte + Timestamp uint64 + func NewMsgCommitEntry() *MsgCommitEntry + func (msg *MsgCommitEntry) BtcDecode(r io.Reader, pver uint32) error + func (msg *MsgCommitEntry) BtcEncode(w io.Writer, pver uint32) error + func (msg *MsgCommitEntry) Command() string + func (msg *MsgCommitEntry) MaxPayloadLength(pver uint32) uint32 + type MsgConfirmation struct + Affirmation [32]byte + ChainID notaryapi.Hash + Hash [32]byte + Height uint64 + Index uint32 + MsgHash *ShaHash + Signature [64]byte + func NewMsgConfirmation(height uint64, index uint32) *MsgConfirmation + func (msg *MsgConfirmation) BtcDecode(r io.Reader, pver uint32) error + func (msg *MsgConfirmation) BtcEncode(w io.Writer, pver uint32) error + func (msg *MsgConfirmation) Command() string + func (msg *MsgConfirmation) MaxPayloadLength(pver uint32) uint32 + type MsgGetAddr struct + func NewMsgGetAddr() *MsgGetAddr + func (msg *MsgGetAddr) BtcDecode(r io.Reader, pver uint32) error + func (msg *MsgGetAddr) BtcEncode(w io.Writer, pver uint32) error + func (msg *MsgGetAddr) Command() string + func (msg *MsgGetAddr) MaxPayloadLength(pver uint32) uint32 + type MsgGetBlocks struct + BlockLocatorHashes []*ShaHash + HashStop ShaHash + ProtocolVersion uint32 + func NewMsgGetBlocks(hashStop *ShaHash) *MsgGetBlocks + func (msg *MsgGetBlocks) AddBlockLocatorHash(hash *ShaHash) error + func (msg *MsgGetBlocks) BtcDecode(r io.Reader, pver uint32) error + func (msg *MsgGetBlocks) BtcEncode(w io.Writer, pver uint32) error + func (msg *MsgGetBlocks) Command() string + func (msg *MsgGetBlocks) MaxPayloadLength(pver uint32) uint32 + type MsgInv struct + InvList []*InvVect + func NewMsgInv() *MsgInv + func NewMsgInvSizeHint(sizeHint uint) *MsgInv + func (msg *MsgInv) AddInvVect(iv *InvVect) error + func (msg *MsgInv) BtcDecode(r io.Reader, pver uint32) error + func (msg *MsgInv) BtcEncode(w io.Writer, pver uint32) error + func (msg *MsgInv) Command() string + func (msg *MsgInv) MaxPayloadLength(pver uint32) uint32 + type MsgNotFound struct + InvList []*InvVect + func NewMsgNotFound() *MsgNotFound + func (msg *MsgNotFound) AddInvVect(iv *InvVect) error + func (msg *MsgNotFound) BtcDecode(r io.Reader, pver uint32) error + func (msg *MsgNotFound) BtcEncode(w io.Writer, pver uint32) error + func (msg *MsgNotFound) Command() string + func (msg *MsgNotFound) MaxPayloadLength(pver uint32) uint32 + type MsgPing struct + Nonce uint64 + func NewMsgPing(nonce uint64) *MsgPing + func (msg *MsgPing) BtcDecode(r io.Reader, pver uint32) error + func (msg *MsgPing) BtcEncode(w io.Writer, pver uint32) error + func (msg *MsgPing) Command() string + func (msg *MsgPing) MaxPayloadLength(pver uint32) uint32 + type MsgPong struct + Nonce uint64 + func NewMsgPong(nonce uint64) *MsgPong + func (msg *MsgPong) BtcDecode(r io.Reader, pver uint32) error + func (msg *MsgPong) BtcEncode(w io.Writer, pver uint32) error + func (msg *MsgPong) Command() string + func (msg *MsgPong) MaxPayloadLength(pver uint32) uint32 + type MsgReject struct + Cmd string + Code RejectCode + Hash ShaHash + Reason string + func NewMsgReject(command string, code RejectCode, reason string) *MsgReject + func (msg *MsgReject) BtcDecode(r io.Reader, pver uint32) error + func (msg *MsgReject) BtcEncode(w io.Writer, pver uint32) error + func (msg *MsgReject) Command() string + func (msg *MsgReject) MaxPayloadLength(pver uint32) uint32 + type MsgRevealChain struct + Chain *notaryapi.EChain + func NewMsgRevealChain() *MsgRevealChain + func (msg *MsgRevealChain) BtcDecode(r io.Reader, pver uint32) error + func (msg *MsgRevealChain) BtcEncode(w io.Writer, pver uint32) error + func (msg *MsgRevealChain) Command() string + func (msg *MsgRevealChain) MaxPayloadLength(pver uint32) uint32 + type MsgRevealEntry struct + Entry *notaryapi.Entry + func NewMsgRevealEntry() *MsgRevealEntry + func (msg *MsgRevealEntry) BtcDecode(r io.Reader, pver uint32) error + func (msg *MsgRevealEntry) BtcEncode(w io.Writer, pver uint32) error + func (msg *MsgRevealEntry) Command() string + func (msg *MsgRevealEntry) MaxPayloadLength(pver uint32) uint32 + type MsgTx struct + Data []byte + func (msg *MsgTx) BtcDecode(r io.Reader, pver uint32) (err error) + func (msg *MsgTx) BtcEncode(w io.Writer, pver uint32) (err error) + func (msg *MsgTx) Command() string + func (msg *MsgTx) MaxPayloadLength(pver uint32) uint32 + func (msg MsgTx) TxType() string + type MsgVerAck struct + func NewMsgVerAck() *MsgVerAck + func (msg *MsgVerAck) BtcDecode(r io.Reader, pver uint32) error + func (msg *MsgVerAck) BtcEncode(w io.Writer, pver uint32) error + func (msg *MsgVerAck) Command() string + func (msg *MsgVerAck) MaxPayloadLength(pver uint32) uint32 + type MsgVersion struct + AddrMe NetAddress + AddrYou NetAddress + DisableRelayTx bool + LastBlock int32 + Nonce uint64 + ProtocolVersion int32 + Services ServiceFlag + Timestamp time.Time + UserAgent string + func NewMsgVersion(me *NetAddress, you *NetAddress, nonce uint64, lastBlock int32) *MsgVersion + func NewMsgVersionFromConn(conn net.Conn, nonce uint64, lastBlock int32) (*MsgVersion, error) + func (msg *MsgVersion) AddService(service ServiceFlag) + func (msg *MsgVersion) AddUserAgent(name string, version string, comments ...string) error + func (msg *MsgVersion) BtcDecode(r io.Reader, pver uint32) error + func (msg *MsgVersion) BtcEncode(w io.Writer, pver uint32) error + func (msg *MsgVersion) Command() string + func (msg *MsgVersion) HasService(service ServiceFlag) bool + func (msg *MsgVersion) MaxPayloadLength(pver uint32) uint32 + type NetAddress struct + IP net.IP + Port uint16 + Services ServiceFlag + Timestamp time.Time + func NewNetAddress(addr net.Addr, services ServiceFlag) (*NetAddress, error) + func NewNetAddressIPPort(ip net.IP, port uint16, services ServiceFlag) *NetAddress + func (na *NetAddress) AddService(service ServiceFlag) + func (na *NetAddress) HasService(service ServiceFlag) bool + func (na *NetAddress) SetAddress(ip net.IP, port uint16) + type RejectCode uint8 + const RejectCheckpoint + const RejectDuplicate + const RejectDust + const RejectInsufficientFee + const RejectInvalid + const RejectMalformed + const RejectNonstandard + const RejectObsolete + func (code RejectCode) String() string + type ServiceFlag uint64 + const SFNodeNetwork + func (f ServiceFlag) String() string + type ShaHash [HashSize]byte + func NewShaHash(newHash []byte) (*ShaHash, error) + func NewShaHashFromStr(hash string) (*ShaHash, error) + func NewShaHashFromStruct(DataStruct interface{}) (*ShaHash, error) + func (hash *ShaHash) Bytes() []byte + func (hash *ShaHash) IsEqual(target *ShaHash) bool + func (hash *ShaHash) SetBytes(newHash []byte) error + func (hash ShaHash) String() string + type TxMessage interface + TxType func() string