Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NOPHandshakeFunc ¶
Types ¶
type DefaultDecoder ¶
type DefaultDecoder struct{}
type GOBDecoder ¶
type GOBDecoder struct{}
type HandshakeFunc ¶
type Peer ¶
type Peer interface {
Close() error
}
Peer is an interface that represents the remote node.
type RPC ¶
RPC represents any arbitrary data that is being sent over the each transport between two nodes in the network
type TCPPeer ¶
type TCPPeer struct {
// contains filtered or unexported fields
}
TCPPeer represents the remote node over a TCP establised connection.
type TCPTransport ¶
type TCPTransport struct {
TCPTransportOpts
// contains filtered or unexported fields
}
func NewTCPTransport ¶
func NewTCPTransport(opts TCPTransportOpts) *TCPTransport
func (*TCPTransport) Consume ¶
func (t *TCPTransport) Consume() <-chan RPC
Consume()<- chan RPC is only read the incoming message received from the channel (peers) and we can not send to the channel Consume implements the Transport interface
func (*TCPTransport) ListenAndAccept ¶
func (t *TCPTransport) ListenAndAccept() error
type TCPTransportOpts ¶
type TCPTransportOpts struct {
ListenAddr string
HandshakeFunc HandshakeFunc
Decoder Decoder
OnPeer func(Peer) error
}
Click to show internal directories.
Click to hide internal directories.