Documentation
¶
Index ¶
- func RunClient(ctx context.Context, addr string, config Config, ...) error
- func RunServer(ctx context.Context, ls net.Listener, config Config, ...) error
- type CA
- type CASource
- type Config
- type Connection
- func (c *Connection) BufferReads()
- func (c *Connection) BufferWrites()
- func (c *Connection) Close()
- func (c *Connection) ReceiveBytes() ([]byte, uint64, error)
- func (c *Connection) ReceiveProton(m ProtonUnmarshaller) (any, uint64, error)
- func (c *Connection) ReceiveRawBytes() ([]byte, uint64, error)
- func (c *Connection) Run(ctx context.Context) error
- func (c *Connection) SendBytes(msg []byte) (uint64, error)
- func (c *Connection) SendProton(msg any, m ProtonMarshaller) (uint64, error)
- func (c *Connection) SendRawBytes(msg []byte) (uint64, error)
- func (c *Connection) SendStream(r io.Reader) error
- type Peer
- type PeerBuffer
- func (b PeerBuffer) Close() error
- func (b PeerBuffer) OtherPeer() PeerBuffer
- func (b PeerBuffer) Read(buf []byte) (int, error)
- func (b PeerBuffer) ReadFrom(r io.Reader) (int64, error)
- func (b PeerBuffer) RunReader(ctx context.Context, peer Peer) error
- func (b PeerBuffer) RunWriter(ctx context.Context, peer Peer) error
- func (b PeerBuffer) Write(buf []byte) (int, error)
- func (b PeerBuffer) WriteTo(w io.Writer) (int64, error)
- type ProtonMarshaller
- type ProtonUnmarshaller
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CA ¶ added in v0.27.0
type CA struct {
// contains filtered or unexported fields
}
CA represents certificate authority issuing TLS configs.
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection allows to communicate with the peer.
func NewConnection ¶
func NewConnection(peer Peer, config Config) *Connection
NewConnection creates new connection.
func (*Connection) BufferReads ¶ added in v0.17.0
func (c *Connection) BufferReads()
BufferReads turns on read buffer.
func (*Connection) BufferWrites ¶ added in v0.17.0
func (c *Connection) BufferWrites()
BufferWrites turns on write buffer.
func (*Connection) ReceiveBytes ¶ added in v0.10.0
func (c *Connection) ReceiveBytes() ([]byte, uint64, error)
ReceiveBytes receives bytes.
func (*Connection) ReceiveProton ¶ added in v0.10.0
func (c *Connection) ReceiveProton(m ProtonUnmarshaller) (any, uint64, error)
ReceiveProton receives proton message from the peer.
func (*Connection) ReceiveRawBytes ¶ added in v0.14.0
func (c *Connection) ReceiveRawBytes() ([]byte, uint64, error)
ReceiveRawBytes receives bytes and returns them with together with length prefix.
func (*Connection) Run ¶ added in v0.1.1
func (c *Connection) Run(ctx context.Context) error
Run runs connection's goroutines.
func (*Connection) SendBytes ¶ added in v0.10.0
func (c *Connection) SendBytes(msg []byte) (uint64, error)
SendBytes sends bytes.
func (*Connection) SendProton ¶ added in v0.10.0
func (c *Connection) SendProton(msg any, m ProtonMarshaller) (uint64, error)
SendProton sends proton message to the peer.
func (*Connection) SendRawBytes ¶ added in v0.14.0
func (c *Connection) SendRawBytes(msg []byte) (uint64, error)
SendRawBytes sends bytes with length prefix already included.
func (*Connection) SendStream ¶ added in v0.11.0
func (c *Connection) SendStream(r io.Reader) error
SendStream sends stream of data taken from the reader.
type PeerBuffer ¶
type PeerBuffer struct {
// contains filtered or unexported fields
}
PeerBuffer simulates the network connection from the peer's view.
func (PeerBuffer) Close ¶ added in v0.1.1
func (b PeerBuffer) Close() error
Close closes the streams.
func (PeerBuffer) OtherPeer ¶
func (b PeerBuffer) OtherPeer() PeerBuffer
OtherPeer returns the corresponding buffer for the other peer in the connection.
func (PeerBuffer) Read ¶
func (b PeerBuffer) Read(buf []byte) (int, error)
Read reads data from the read buffer.
func (PeerBuffer) ReadFrom ¶ added in v0.1.1
func (b PeerBuffer) ReadFrom(r io.Reader) (int64, error)
ReadFrom reads data from the incoming stream.
func (PeerBuffer) RunReader ¶ added in v0.15.0
func (b PeerBuffer) RunReader(ctx context.Context, peer Peer) error
RunReader reads data from peer.
func (PeerBuffer) RunWriter ¶ added in v0.15.0
func (b PeerBuffer) RunWriter(ctx context.Context, peer Peer) error
RunWriter writes data to peer.