Documentation ¶
Overview ¶
Package wire provides low level access to the Ethereum network and allows you to broadcast data over the network.
Index ¶
Constants ¶
const ( // Values are given explicitly instead of by iota because these values are // defined by the wire protocol spec; it is easier for humans to ensure // correctness when values are explicit. MsgHandshakeTy = 0x00 MsgDiscTy = 0x01 MsgPingTy = 0x02 MsgPongTy = 0x03 MsgGetPeersTy = 0x04 MsgPeersTy = 0x05 MsgStatusTy = 0x10 MsgTxTy = 0x12 MsgGetBlockHashesTy = 0x13 MsgBlockHashesTy = 0x14 MsgGetBlocksTy = 0x15 MsgBlockTy = 0x16 MsgNewBlockTy = 0x17 )
Variables ¶
var MagicToken = []byte{34, 64, 8, 145}
The magic token which should be the first 4 bytes of every message and can be used as separator between messages.
Functions ¶
Types ¶
type ClientIdentity ¶
type ClientIdentity interface {
String() string
}
should be used in Peer handleHandshake, incorporate Caps, ProtocolVersion, Pubkey etc.
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
The connection object allows you to set up a connection to the Ethereum network. The Connection object takes care of all encoding and sending objects properly over the network.
func (*Connection) Read ¶
func (self *Connection) Read() *Msg
Read, reads from the network. It will block until the next message is received.
func (*Connection) Write ¶
func (self *Connection) Write(typ MsgType, v ...interface{}) error
Write to the Ethereum network specifying the type of the message and the data. Data can be of type RlpEncodable or []interface{}. Returns nil or if something went wrong an error.
type Msg ¶
type Msg struct { Type MsgType // Specifies how the encoded data should be interpreted //Data []byte Data *ethutil.Value }
func NewMessage ¶
type SimpleClientIdentity ¶
type SimpleClientIdentity struct {
// contains filtered or unexported fields
}
func NewSimpleClientIdentity ¶
func NewSimpleClientIdentity(clientIdentifier string, version string, customIdentifier string) *SimpleClientIdentity
func (*SimpleClientIdentity) GetCustomIdentifier ¶
func (c *SimpleClientIdentity) GetCustomIdentifier() string
func (*SimpleClientIdentity) SetCustomIdentifier ¶
func (c *SimpleClientIdentity) SetCustomIdentifier(customIdentifier string)
func (*SimpleClientIdentity) String ¶
func (c *SimpleClientIdentity) String() string