Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SendMsgData ¶
Types ¶
type Config ¶
type Config struct { Nat nat.Mapper ListenAddr string Key *ecdsa.PrivateKey Discover bool NodeDBPath string StaticNodes []*discover.Node BootstrapNodes []*discover.Node MaxPeers int Logger log.Logger Encoder encoder }
Config Background network service configuration
type MessageReader ¶
type MessageReader interface { Type() uint8 // message type Read(p []byte) (int, error) // read given data to buffer ReadAll() ([]byte, error) // read all of messages RawReader() io.Reader // read raw messages(include version and mType fields) DataReader() io.Reader // read data of message }
MessageReader interface defines type of message and reading methods, messageReader implements this interface.
func ReadMessage ¶
func ReadMessage(reader io.Reader) (MessageReader, error)
ReadMessage reads message from other peer and returns MessageReader by header of message. message = version(1byte)+type(1byte)+length(4byte)+data
Source Files ¶
Click to show internal directories.
Click to hide internal directories.