Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var MainNetStartString = []byte{0xf9, 0xbe, 0xb4, 0xd9}
View Source
var RegTestStartString = []byte{0xfa, 0xbf, 0xb5, 0xda}
View Source
var TestNetStartString = []byte{0x0b, 0x11, 0x09, 0x07}
TODO add support for test nets.
Functions ¶
func SeekToNextMessage ¶
Consume input until a start string is found. The start string is also consumed.
Types ¶
type Conn ¶
type Conn interface { // Name/address of the endpoint we're connected to. Endpoint() string // Write to this channel to send messages on the connection. WriteChannel() chan<- Message // Connection failed to set up and should not be used or closed. Only // initial errors will set this, later errors will come through // the channel provided to Run(). Error() error // Start the operation of a connected connection. Errors and received // messages will be passed on the provided channel. The caller can // safely close the channel after Close() returns. Run(chan<- Message) // Close connection. Blocks until it's done, specifically it's safe to // close the channel provided to Run() when this call returns. Only // call when connected, ie. when Error() == nil. Close() MostRecentActivity() time.Time }
type ConnImpl ¶
type ConnImpl struct {
// contains filtered or unexported fields
}
func (*ConnImpl) MostRecentActivity ¶
func (*ConnImpl) Run ¶
startMainThread starts the main loop than handles incoming and outgoing messages. Incoming messages are forwarded to the read channel provided.
func (*ConnImpl) WriteChannel ¶
type Message ¶
type Message struct { Endpoint string Type string Data []byte // contains filtered or unexported fields }
func ErrorMessage ¶
func NewMessage ¶
Click to show internal directories.
Click to hide internal directories.