Documentation ¶
Index ¶
Constants ¶
View Source
const ( IncomingMessage = 0x1 IncomingStream = 0x2 )
Variables ¶
This section is empty.
Functions ¶
func DumbHandShakeFunc ¶
Types ¶
type DefaultDecoder ¶
type DefaultDecoder struct{}
type GOBDecoder ¶
type GOBDecoder struct{}
type HandShakeFunc ¶
type RPC ¶
RPC holds any arbitrary data that is being sent between two nodes in the network over a transport.
type TCPPeer ¶
type TCPPeer struct { // The peer connection it self. TCP in this case net.Conn // contains filtered or unexported fields }
TCPPeer is the network remote node over a TCP transport estabilished connection
func (*TCPPeer) CloseStream ¶
func (p *TCPPeer) CloseStream()
type TCPTransport ¶
type TCPTransport struct { TCPTransportOptions // contains filtered or unexported fields }
func NewTCPTranport ¶
func NewTCPTranport(options TCPTransportOptions) *TCPTransport
func (*TCPTransport) Addr ¶
func (t *TCPTransport) Addr() string
Addr implements the Transport interface returns the address. transport is accepting new connections.
func (*TCPTransport) Close ¶
func (t *TCPTransport) Close() error
Close implements the Transport interface
func (*TCPTransport) Consume ¶
func (t *TCPTransport) Consume() <-chan RPC
Consume implements the Transport interface, returns a read-only of incoming messages received from a connected peer in the network.
func (*TCPTransport) Dial ¶
func (t *TCPTransport) Dial(addr string) error
Dial implements the Transport interface
func (*TCPTransport) ListenAndAccept ¶
func (t *TCPTransport) ListenAndAccept() error
type TCPTransportOptions ¶
type TCPTransportOptions struct { ListenAddr string HandShakeFunc HandShakeFunc Decoder Decoder OnPeer func(Peer) error }
Click to show internal directories.
Click to hide internal directories.