Documentation
¶
Index ¶
- func RunClient[M proton.Marshaller](ctx context.Context, addr string, config Config[M], ...) error
- func RunServer[M proton.Marshaller](ctx context.Context, ls net.Listener, config Config[M], ...) error
- type Config
- type Connection
- 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) Run(ctx context.Context, peer Peer) error
- func (b PeerBuffer) Write(buf []byte) (int, error)
- func (b PeerBuffer) WriteTo(w io.Writer) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config[M proton.Marshaller] struct { MaxMessageSize uint64 Marshaller M }
Config is the configuration of connection.
type Connection ¶
type Connection[M proton.Marshaller] struct { // contains filtered or unexported fields }
Connection allows to communicate with the peer.
func NewConnection ¶
func NewConnection[M proton.Marshaller](peer Peer, config Config[M]) *Connection[M]
NewConnection creates new connection.
func (*Connection[M]) Receive ¶
func (c *Connection[M]) Receive() (any, bool)
Receive receives message from the peer.
func (*Connection[M]) Run ¶ added in v0.1.1
func (c *Connection[M]) Run(ctx context.Context) error
Run runs the connection.
func (*Connection[M]) Send ¶
func (c *Connection[M]) Send(msg proton.Marshallable) bool
Send sends message to the peer.
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) Run ¶ added in v0.1.1
func (b PeerBuffer) Run(ctx context.Context, peer Peer) error
Run runs the goroutines responsible for copying data between this buffer and the external one.
Click to show internal directories.
Click to hide internal directories.