Documentation ¶
Index ¶
- Constants
- Variables
- func TxType2DBHeader(typ tx.Type) (db.Header, error)
- func Write(s *setting.Setting, m proto.Marshaler, cmd Command, conn io.Writer) error
- type Addr
- func (*Addr) Descriptor() ([]byte, []int)
- func (this *Addr) Equal(that interface{}) bool
- func (m *Addr) Marshal() (dAtA []byte, err error)
- func (m *Addr) MarshalTo(dAtA []byte) (int, error)
- func (*Addr) ProtoMessage()
- func (m *Addr) Reset()
- func (m *Addr) Size() (n int)
- func (m *Addr) String() string
- func (m *Addr) Unmarshal(dAtA []byte) error
- func (m *Addr) XXX_DiscardUnknown()
- func (m *Addr) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Addr) XXX_Merge(src proto.Message)
- func (m *Addr) XXX_Size() int
- func (m *Addr) XXX_Unmarshal(b []byte) error
- type Addrs
- type AddrsProto
- func (*AddrsProto) Descriptor() ([]byte, []int)
- func (this *AddrsProto) Equal(that interface{}) bool
- func (m *AddrsProto) Marshal() (dAtA []byte, err error)
- func (m *AddrsProto) MarshalTo(dAtA []byte) (int, error)
- func (*AddrsProto) ProtoMessage()
- func (m *AddrsProto) Reset()
- func (m *AddrsProto) Size() (n int)
- func (m *AddrsProto) String() string
- func (m *AddrsProto) Unmarshal(dAtA []byte) error
- func (m *AddrsProto) XXX_DiscardUnknown()
- func (m *AddrsProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *AddrsProto) XXX_Merge(src proto.Message)
- func (m *AddrsProto) XXX_Size() int
- func (m *AddrsProto) XXX_Unmarshal(b []byte) error
- type Command
- type Hashes
- func (*Hashes) Descriptor() ([]byte, []int)
- func (this *Hashes) Equal(that interface{}) bool
- func (m *Hashes) Marshal() (dAtA []byte, err error)
- func (m *Hashes) MarshalTo(dAtA []byte) (int, error)
- func (*Hashes) ProtoMessage()
- func (m *Hashes) Reset()
- func (m *Hashes) Size() (n int)
- func (m *Hashes) String() string
- func (m *Hashes) Unmarshal(dAtA []byte) error
- func (m *Hashes) XXX_DiscardUnknown()
- func (m *Hashes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Hashes) XXX_Merge(src proto.Message)
- func (m *Hashes) XXX_Size() int
- func (m *Hashes) XXX_Unmarshal(b []byte) error
- type InvType
- type Inventories
- type InventoriesProto
- func (*InventoriesProto) Descriptor() ([]byte, []int)
- func (this *InventoriesProto) Equal(that interface{}) bool
- func (m *InventoriesProto) Marshal() (dAtA []byte, err error)
- func (m *InventoriesProto) MarshalTo(dAtA []byte) (int, error)
- func (*InventoriesProto) ProtoMessage()
- func (m *InventoriesProto) Reset()
- func (m *InventoriesProto) Size() (n int)
- func (m *InventoriesProto) String() string
- func (m *InventoriesProto) Unmarshal(dAtA []byte) error
- func (m *InventoriesProto) XXX_DiscardUnknown()
- func (m *InventoriesProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *InventoriesProto) XXX_Merge(src proto.Message)
- func (m *InventoriesProto) XXX_Size() int
- func (m *InventoriesProto) XXX_Unmarshal(b []byte) error
- type Inventory
- func (*Inventory) Descriptor() ([]byte, []int)
- func (this *Inventory) Equal(that interface{}) bool
- func (m *Inventory) Marshal() (dAtA []byte, err error)
- func (m *Inventory) MarshalTo(dAtA []byte) (int, error)
- func (*Inventory) ProtoMessage()
- func (m *Inventory) Reset()
- func (m *Inventory) Size() (n int)
- func (m *Inventory) String() string
- func (m *Inventory) Unmarshal(dAtA []byte) error
- func (m *Inventory) XXX_DiscardUnknown()
- func (m *Inventory) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Inventory) XXX_Merge(src proto.Message)
- func (m *Inventory) XXX_Size() int
- func (m *Inventory) XXX_Unmarshal(b []byte) error
- type Nonce
- type NonceProto
- func (*NonceProto) Descriptor() ([]byte, []int)
- func (this *NonceProto) Equal(that interface{}) bool
- func (m *NonceProto) Marshal() (dAtA []byte, err error)
- func (m *NonceProto) MarshalTo(dAtA []byte) (int, error)
- func (*NonceProto) ProtoMessage()
- func (m *NonceProto) Reset()
- func (m *NonceProto) Size() (n int)
- func (m *NonceProto) String() string
- func (m *NonceProto) Unmarshal(dAtA []byte) error
- func (m *NonceProto) XXX_DiscardUnknown()
- func (m *NonceProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *NonceProto) XXX_Merge(src proto.Message)
- func (m *NonceProto) XXX_Size() int
- func (m *NonceProto) XXX_Unmarshal(b []byte) error
- type Tx
- func (*Tx) Descriptor() ([]byte, []int)
- func (this *Tx) Equal(that interface{}) bool
- func (m *Tx) Marshal() (dAtA []byte, err error)
- func (m *Tx) MarshalTo(dAtA []byte) (int, error)
- func (*Tx) ProtoMessage()
- func (m *Tx) Reset()
- func (m *Tx) Size() (n int)
- func (m *Tx) String() string
- func (m *Tx) Unmarshal(dAtA []byte) error
- func (m *Tx) XXX_DiscardUnknown()
- func (m *Tx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Tx) XXX_Merge(src proto.Message)
- func (m *Tx) XXX_Size() int
- func (m *Tx) XXX_Unmarshal(b []byte) error
- type Txs
- type TxsProto
- func (*TxsProto) Descriptor() ([]byte, []int)
- func (this *TxsProto) Equal(that interface{}) bool
- func (m *TxsProto) Marshal() (dAtA []byte, err error)
- func (m *TxsProto) MarshalTo(dAtA []byte) (int, error)
- func (*TxsProto) ProtoMessage()
- func (m *TxsProto) Reset()
- func (m *TxsProto) Size() (n int)
- func (m *TxsProto) String() string
- func (m *TxsProto) Unmarshal(dAtA []byte) error
- func (m *TxsProto) XXX_DiscardUnknown()
- func (m *TxsProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *TxsProto) XXX_Merge(src proto.Message)
- func (m *TxsProto) XXX_Size() int
- func (m *TxsProto) XXX_Unmarshal(b []byte) error
- type Version
- func (*Version) Descriptor() ([]byte, []int)
- func (this *Version) Equal(that interface{}) bool
- func (m *Version) Marshal() (dAtA []byte, err error)
- func (m *Version) MarshalTo(dAtA []byte) (int, error)
- func (*Version) ProtoMessage()
- func (m *Version) Reset()
- func (m *Version) Size() (n int)
- func (m *Version) String() string
- func (m *Version) Unmarshal(dAtA []byte) error
- func (m *Version) XXX_DiscardUnknown()
- func (m *Version) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (dst *Version) XXX_Merge(src proto.Message)
- func (m *Version) XXX_Size() int
- func (m *Version) XXX_Unmarshal(b []byte) error
Constants ¶
const ( MaxLength = 5000000 MaxAddrs = 100 MaxInv = 1000 MaxTx = 1000 )
Maxs for messages.
const MessageVersion = 1
MessageVersion is a version of the message.
const (
ServiceFull byte = iota
)
Services in Version mesasge.
Variables ¶
var ( ErrInvalidLengthMsg = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowMsg = fmt.Errorf("proto: integer overflow") )
var ( //ConnectionTimeout is the priod of sending ping. ConnectionTimeout = 10 * time.Minute )
Functions ¶
func TxType2DBHeader ¶
TxType2DBHeader return db beader from tx type.
Types ¶
type Addr ¶
type Addr struct { Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` Service byte `protobuf:"varint,2,opt,name=service,proto3,casttype=byte" json:"service,omitempty"` }
Addr is an IP address and port.
func NewPopulatedAddr ¶
func (*Addr) Descriptor ¶
func (*Addr) ProtoMessage ¶
func (*Addr) ProtoMessage()
func (*Addr) XXX_DiscardUnknown ¶
func (m *Addr) XXX_DiscardUnknown()
func (*Addr) XXX_Unmarshal ¶
type AddrsProto ¶
type AddrsProto struct {
Addrs []*Addr `protobuf:"bytes,1,rep,name=addrs,proto3" json:"addrs,omitempty"`
}
func NewPopulatedAddrsProto ¶
func NewPopulatedAddrsProto(r randyMsg, easy bool) *AddrsProto
func (*AddrsProto) Descriptor ¶
func (*AddrsProto) Descriptor() ([]byte, []int)
func (*AddrsProto) Equal ¶
func (this *AddrsProto) Equal(that interface{}) bool
func (*AddrsProto) Marshal ¶
func (m *AddrsProto) Marshal() (dAtA []byte, err error)
func (*AddrsProto) ProtoMessage ¶
func (*AddrsProto) ProtoMessage()
func (*AddrsProto) Reset ¶
func (m *AddrsProto) Reset()
func (*AddrsProto) Size ¶
func (m *AddrsProto) Size() (n int)
func (*AddrsProto) String ¶
func (m *AddrsProto) String() string
func (*AddrsProto) Unmarshal ¶
func (m *AddrsProto) Unmarshal(dAtA []byte) error
func (*AddrsProto) XXX_DiscardUnknown ¶
func (m *AddrsProto) XXX_DiscardUnknown()
func (*AddrsProto) XXX_Marshal ¶
func (m *AddrsProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*AddrsProto) XXX_Merge ¶
func (dst *AddrsProto) XXX_Merge(src proto.Message)
func (*AddrsProto) XXX_Size ¶
func (m *AddrsProto) XXX_Size() int
func (*AddrsProto) XXX_Unmarshal ¶
func (m *AddrsProto) XXX_Unmarshal(b []byte) error
type Command ¶
type Command byte
Command is a command byte
const ( CmdVersion Command = iota + 1 //Header + Version p2p 1 CmdVerack // Header p2p 2 CmdPing // Header + Nonce ,p2p 3 CmdPong // Header+ Nonce,p2p 4 CmdGetAddr // Header,p2p 5 CmdAddr // Header * Addrs,p2p 6 CmdInv // Header + Inventories,broadcast 7 CmdGetData // Header+ Inventories,p2p 8 CmdTxs // Header+ Txs,p2p 9 CmdClose //Header,p2p 12 CmdGetLeaves // Header + LeavesFrom,p2p 10 CmdLeaves // Header + Inventories,p2p 11 CmdFollowingHash CmdGetFollowingHash CmdConsensusMessage //15 )
Commands in Header.
func ReadHeader ¶
ReadHeader read a message from con and returns msg type.
type Hashes ¶
type Hashes struct {
Hashes []github_com_AidosKuneen_aklib_tx.Hash `protobuf:"bytes,1,rep,name=hashes,proto3,casttype=github.com/AidosKuneen/aklib/tx.Hash" json:"hashes,omitempty"`
}
func NewPopulatedHashes ¶
func (*Hashes) Descriptor ¶
func (*Hashes) ProtoMessage ¶
func (*Hashes) ProtoMessage()
func (*Hashes) XXX_DiscardUnknown ¶
func (m *Hashes) XXX_DiscardUnknown()
func (*Hashes) XXX_Marshal ¶
func (*Hashes) XXX_Unmarshal ¶
type InvType ¶
type InvType byte
InvType is a tx type of Inv.
func TxType2InvType ¶
TxType2InvType return inventory type from tx type.
type Inventories ¶
type Inventories []*Inventory
Inventories is a slice of Inventory, for inv, getdata, notfound messages.
func ReadInventories ¶
func ReadInventories(buf []byte) (Inventories, error)
ReadInventories read and make a Inventories struct.
type InventoriesProto ¶
type InventoriesProto struct {
Inventories []*Inventory `protobuf:"bytes,1,rep,name=inventories,proto3" json:"inventories,omitempty"`
}
func NewPopulatedInventoriesProto ¶
func NewPopulatedInventoriesProto(r randyMsg, easy bool) *InventoriesProto
func (*InventoriesProto) Descriptor ¶
func (*InventoriesProto) Descriptor() ([]byte, []int)
func (*InventoriesProto) Equal ¶
func (this *InventoriesProto) Equal(that interface{}) bool
func (*InventoriesProto) Marshal ¶
func (m *InventoriesProto) Marshal() (dAtA []byte, err error)
func (*InventoriesProto) ProtoMessage ¶
func (*InventoriesProto) ProtoMessage()
func (*InventoriesProto) Reset ¶
func (m *InventoriesProto) Reset()
func (*InventoriesProto) Size ¶
func (m *InventoriesProto) Size() (n int)
func (*InventoriesProto) String ¶
func (m *InventoriesProto) String() string
func (*InventoriesProto) Unmarshal ¶
func (m *InventoriesProto) Unmarshal(dAtA []byte) error
func (*InventoriesProto) XXX_DiscardUnknown ¶
func (m *InventoriesProto) XXX_DiscardUnknown()
func (*InventoriesProto) XXX_Marshal ¶
func (m *InventoriesProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*InventoriesProto) XXX_Merge ¶
func (dst *InventoriesProto) XXX_Merge(src proto.Message)
func (*InventoriesProto) XXX_Size ¶
func (m *InventoriesProto) XXX_Size() int
func (*InventoriesProto) XXX_Unmarshal ¶
func (m *InventoriesProto) XXX_Unmarshal(b []byte) error
type Inventory ¶
type Inventory struct { Type InvType `protobuf:"varint,1,opt,name=type,proto3,casttype=InvType" json:"type,omitempty"` Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` }
Inventory vectors are used for notifying other nodes about objects they have or data which is being requested.
func NewPopulatedInventory ¶
func (*Inventory) Descriptor ¶
func (*Inventory) ProtoMessage ¶
func (*Inventory) ProtoMessage()
func (*Inventory) XXX_DiscardUnknown ¶
func (m *Inventory) XXX_DiscardUnknown()
func (*Inventory) XXX_Marshal ¶
func (*Inventory) XXX_Unmarshal ¶
type NonceProto ¶
type NonceProto struct {
Nonce []byte `protobuf:"bytes,1,opt,name=nonce,proto3" json:"nonce,omitempty"`
}
func NewPopulatedNonceProto ¶
func NewPopulatedNonceProto(r randyMsg, easy bool) *NonceProto
func (*NonceProto) Descriptor ¶
func (*NonceProto) Descriptor() ([]byte, []int)
func (*NonceProto) Equal ¶
func (this *NonceProto) Equal(that interface{}) bool
func (*NonceProto) Marshal ¶
func (m *NonceProto) Marshal() (dAtA []byte, err error)
func (*NonceProto) ProtoMessage ¶
func (*NonceProto) ProtoMessage()
func (*NonceProto) Reset ¶
func (m *NonceProto) Reset()
func (*NonceProto) Size ¶
func (m *NonceProto) Size() (n int)
func (*NonceProto) String ¶
func (m *NonceProto) String() string
func (*NonceProto) Unmarshal ¶
func (m *NonceProto) Unmarshal(dAtA []byte) error
func (*NonceProto) XXX_DiscardUnknown ¶
func (m *NonceProto) XXX_DiscardUnknown()
func (*NonceProto) XXX_Marshal ¶
func (m *NonceProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*NonceProto) XXX_Merge ¶
func (dst *NonceProto) XXX_Merge(src proto.Message)
func (*NonceProto) XXX_Size ¶
func (m *NonceProto) XXX_Size() int
func (*NonceProto) XXX_Unmarshal ¶
func (m *NonceProto) XXX_Unmarshal(b []byte) error
type Tx ¶
type Tx struct { Type InvType `protobuf:"varint,1,opt,name=type,proto3,casttype=InvType" json:"type,omitempty"` Tx *tx.Transaction `protobuf:"bytes,2,opt,name=tx,proto3" json:"tx,omitempty"` }
Tx describes a transaction with Invenroty type.
func NewPopulatedTx ¶
func (*Tx) Descriptor ¶
func (*Tx) ProtoMessage ¶
func (*Tx) ProtoMessage()
func (*Tx) XXX_DiscardUnknown ¶
func (m *Tx) XXX_DiscardUnknown()
func (*Tx) XXX_Unmarshal ¶
type TxsProto ¶
type TxsProto struct {
Txs []*Tx `protobuf:"bytes,1,rep,name=txs,proto3" json:"txs,omitempty"`
}
func NewPopulatedTxsProto ¶
func (*TxsProto) Descriptor ¶
func (*TxsProto) ProtoMessage ¶
func (*TxsProto) ProtoMessage()
func (*TxsProto) XXX_DiscardUnknown ¶
func (m *TxsProto) XXX_DiscardUnknown()
func (*TxsProto) XXX_Marshal ¶
func (*TxsProto) XXX_Unmarshal ¶
type Version ¶
type Version struct { Version uint16 `protobuf:"varint,1,opt,name=version,proto3,casttype=uint16" json:"version,omitempty"` Nonce uint64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"` AddrFrom Addr `protobuf:"bytes,3,opt,name=addr_from,json=addrFrom,proto3" json:"addr_from"` AddrTo Addr `protobuf:"bytes,4,opt,name=addr_to,json=addrTo,proto3" json:"addr_to"` UserAgent string `protobuf:"bytes,5,opt,name=user_agent,json=userAgent,proto3" json:"user_agent,omitempty"` }
Version is a message when a node creates an outgoing connection.
func NewPopulatedVersion ¶
func NewVersion ¶
NewVersion returns Verstion struct.
func ReadVersion ¶
ReadVersion read and make a Version struct.
func (*Version) Descriptor ¶
func (*Version) ProtoMessage ¶
func (*Version) ProtoMessage()
func (*Version) XXX_DiscardUnknown ¶
func (m *Version) XXX_DiscardUnknown()