Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TCPNode ¶
type TCPNode struct { // The underlying TCP connection of the peer net.Conn // contains filtered or unexported fields }
TCPNode represents the remote node over a TCP established connection.
func NewTCPNode ¶
func (*TCPNode) CloseStream ¶
func (p *TCPNode) CloseStream()
type TCPTransport ¶
type TCPTransport struct {
// contains filtered or unexported fields
}
func NewTCPTransport ¶
func NewTCPTransport(opts ...TCPTransportOption) (*TCPTransport, error)
Create a new TCPTransport with the given configuration.
func (*TCPTransport) Addr ¶
func (t *TCPTransport) Addr() string
Implement the Transport interface by returning the address of the TCPTransport.
func (*TCPTransport) Close ¶
func (t *TCPTransport) Close() error
Implement the Transport interface closing the listener.
func (*TCPTransport) ListenAndAccept ¶
func (t *TCPTransport) ListenAndAccept() error
Implement the Transport interface listening and handling incoming connections.
type TCPTransportOption ¶
type TCPTransportOption func(*tcpTransportOpts) error
TCPTransportOption is a function that updates the tcpTransportOpts struct.
func WithListenAddr ¶
func WithListenAddr(addr string) TCPTransportOption
WithListenAddr is a configuration function that updates the listen address.
func WithLogger ¶
func WithLogger(logger *slog.Logger) TCPTransportOption
WithLogger is a configuration function that updates the logger.
type Transport ¶
type Transport interface { // Addr returns the address of the transport. Addr() string // Close closes the transport. Close() error // ListenAndAccept listens for incoming connections and accepts them. ListenAndAccept() error }
Transport is anything that handles network communication between nodes.