Documentation ¶
Index ¶
- Constants
- func BytesToCommand(bytes []byte) string
- func CommandToBytes(command string) []byte
- func ExtractCommand(request []byte) []byte
- func GobEncode(data interface{}) []byte
- func MakeRequest(data interface{}, cmd string) []byte
- type Configuration
- type Header
- type Protocol
- func (*Protocol) HandleAddr(request []byte)
- func (p *Protocol) HandleBlock(request []byte)
- func (*Protocol) HandleError(request []byte)
- func (p *Protocol) HandleGetBlocks(request []byte)
- func (p *Protocol) HandleGetData(request []byte)
- func (p *Protocol) HandleInv(request []byte)
- func (*Protocol) HandleMessage(request []byte)
- func (p *Protocol) HandlePing(request []byte) bool
- func (*Protocol) HandlePong(request []byte)
- func (p *Protocol) HandleTx(request []byte)
- func (p *Protocol) HandleVersion(request []byte)
- func (p *Protocol) SendAddr(addrTo string) bool
- func (p *Protocol) SendBlock(addrFrom, addrTo string, newBlock types.Block) bool
- func (p *Protocol) SendGetBlocks(addrFrom, addrTo string) bool
- func (p *Protocol) SendGetData(addrFrom, addrTo, kind string, id []byte) bool
- func (p *Protocol) SendInv(addrFrom, addrTo, kind string, items [][]byte) bool
- func (p *Protocol) SendMessage(addrTo, msgType string) bool
- func (p *Protocol) SendPing(addrFrom, addrTo string) bool
- func (p *Protocol) SendPong(addrFrom, addrTo string) bool
- func (p *Protocol) SendTx(addrFrom, addrTo string, tnx types.Transaction) bool
- func (p *Protocol) SendVersion(addrFrom, addrTo string) bool
Constants ¶
View Source
const ( C_TX = "tx" C_INV = "inv" C_PING = "ping" C_PONG = "pong" C_ADDR = "addr" C_BLOCK = "block" C_ERROR = "error" C_VERSION = "version" C_GETDATA = "getdata" C_GETBLOCKS = "getblocks" C_MESSAGE = "msg" C_SYNCED = "synced" )
View Source
const ( PROTOCOL = "tcp" NODE_VERSION = 1 COMMAND_LENGTH = 12 )
Variables ¶
This section is empty.
Functions ¶
func BytesToCommand ¶
func CommandToBytes ¶
func ExtractCommand ¶
func MakeRequest ¶
Types ¶
type Configuration ¶
type Configuration struct { Chain *core.BlockChain Nodes *map[string]bool }
type Protocol ¶
type Protocol struct {
Config *Configuration
}
func (*Protocol) HandleAddr ¶
func (*Protocol) HandleBlock ¶
func (*Protocol) HandleError ¶
func (*Protocol) HandleGetBlocks ¶
func (*Protocol) HandleGetData ¶
func (*Protocol) HandleMessage ¶
func (*Protocol) HandlePing ¶
func (*Protocol) HandlePong ¶
func (*Protocol) HandleVersion ¶
func (*Protocol) SendGetBlocks ¶
func (*Protocol) SendGetData ¶
func (*Protocol) SendMessage ¶
func (*Protocol) SendTx ¶
func (p *Protocol) SendTx(addrFrom, addrTo string, tnx types.Transaction) bool
func (*Protocol) SendVersion ¶
Click to show internal directories.
Click to hide internal directories.