Documentation ¶
Index ¶
Constants ¶
View Source
const ( IncomingMessage = 0x1 IncomingStream = 0x2 )
Variables ¶
This section is empty.
Functions ¶
func NOPHandshakeFunc ¶
Types ¶
type DefaultDecoder ¶
type DefaultDecoder struct{}
type GOBDecoder ¶
type GOBDecoder struct{}
type HandshakeFunc ¶
HandshakeFunc is a function that is called when a new connection is established.
type TCPPeer ¶
type TCPPeer struct { // The underlying TCP connection of the peer. net.Conn // contains filtered or unexported fields }
TCPPeer represents the remote node over a TCP established connection.
func (*TCPPeer) CloseStream ¶
func (p *TCPPeer) CloseStream()
type TCPTransport ¶
type TCPTransport struct { TCPTransportOpts // contains filtered or unexported fields }
func NewTCPTransport ¶
func NewTCPTransport(opts TCPTransportOpts) *TCPTransport
func (*TCPTransport) Addr ¶
func (t *TCPTransport) Addr() string
Addr implements the Transport interface, which will return the address of the transport, which is accepting connection.
func (*TCPTransport) Close ¶
func (t *TCPTransport) Close() error
Close implements the Transport interface, which will close the underlying TCP listener.
func (*TCPTransport) Consume ¶
func (t *TCPTransport) Consume() <-chan RPC
Consume implements the Transport interface, which will return read-only channel for reading incoming messages received from another peer in the network.
func (*TCPTransport) Dial ¶
func (t *TCPTransport) Dial(addr string) error
Dial implements the Transport interface, which will dial a remote node in the network.
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.