Documentation ¶
Index ¶
- func EncodeFrame(t frames.Type, channel uint16, f frames.FrameBody) ([]byte, error)
- func PerformBegin(channel, remoteChannel uint16) ([]byte, error)
- func PerformClose(e *encoding.Error) ([]byte, error)
- func PerformDetach(channel uint16, linkHandle uint32, e *encoding.Error) ([]byte, error)
- func PerformDisposition(role encoding.Role, channel uint16, firstID uint32, lastID *uint32, ...) ([]byte, error)
- func PerformEnd(channel uint16, e *encoding.Error) ([]byte, error)
- func PerformOpen(containerID string) ([]byte, error)
- func PerformTransfer(channel uint16, linkHandle, deliveryID uint32, payload []byte) ([]byte, error)
- func ProtoHeader(id ProtoID) ([]byte, error)
- func ReceiverAttach(channel uint16, linkName string, linkHandle uint32, ...) ([]byte, error)
- func SenderAttach(channel uint16, linkName string, linkHandle uint32, ...) ([]byte, error)
- type AMQPProto
- type KeepAlive
- type NetConn
- func (n *NetConn) Close() error
- func (n *NetConn) LocalAddr() net.Addr
- func (n *NetConn) Read(b []byte) (int, error)
- func (n *NetConn) RemoteAddr() net.Addr
- func (n *NetConn) SendFrame(f []byte)
- func (n *NetConn) SendKeepAlive()
- func (n *NetConn) SendMultiFrameTransfer(channel uint16, linkHandle, deliveryID uint32, payload []byte, ...) error
- func (n *NetConn) SetDeadline(t time.Time) error
- func (n *NetConn) SetReadDeadline(t time.Time) error
- func (n *NetConn) SetWriteDeadline(t time.Time) error
- func (n *NetConn) Write(b []byte) (int, error)
- type ProtoID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeFrame ¶
EncodeFrame encodes the specified frame to be sent over the wire.
func PerformBegin ¶
PerformBegin appends a PerformBegin frame with the specified remote channel ID. This frame is needed when making a call to Client.NewSession().
func PerformClose ¶
PerformClose encodes a PerformClose frame with an optional error.
func PerformDetach ¶
PerformDetach encodes a PerformDetach frame with an optional error.
func PerformDisposition ¶
func PerformDisposition(role encoding.Role, channel uint16, firstID uint32, lastID *uint32, state encoding.DeliveryState) ([]byte, error)
PerformDisposition appends a PerformDisposition frame with the specified values. The firstID MUST match the deliveryID value specified in PerformTransfer.
func PerformEnd ¶
PerformEnd encodes a PerformEnd frame with an optional error.
func PerformOpen ¶
PerformOpen appends a PerformOpen frame with the specified container ID. This frame, and ProtoHeader, are needed when calling amqp.New() to create a client.
func PerformTransfer ¶
PerformTransfer appends a PerformTransfer frame with the specified values. The linkHandle MUST match the linkHandle value specified in ReceiverAttach.
func ProtoHeader ¶
ProtoHeader adds the initial handshake frame to the list of responses. This frame, and PerformOpen, are needed when calling amqp.New() to create a client.
func ReceiverAttach ¶
func ReceiverAttach(channel uint16, linkName string, linkHandle uint32, mode encoding.ReceiverSettleMode, filter encoding.Filter) ([]byte, error)
ReceiverAttach appends a PerformAttach frame with the specified values. This frame is needed when making a call to Session.NewReceiver().
func SenderAttach ¶
func SenderAttach(channel uint16, linkName string, linkHandle uint32, mode encoding.SenderSettleMode) ([]byte, error)
SenderAttach encodes a PerformAttach frame with the specified values. This frame is needed when making a call to Session.NewSender().
Types ¶
type AMQPProto ¶
AMQPProto is the frame type passed to FrameCallback() for the initial protocal handshake.
type NetConn ¶
type NetConn struct { // OnClose is called from Close() before it returns. // The value returned from OnClose is returned from Close(). OnClose func() error // ReadErr is used to simulate a connReader error. // The error written to this channel is returned // from the call to NetConn.Read. ReadErr chan error // WriteErr is used to simulate a connWriter error. // The error sent here is returned from the call to NetConn.Write. // Has a buffer of one so setting a pending error won't block. WriteErr chan error // contains filtered or unexported fields }
NetConn is a mock network connection that satisfies the net.Conn interface.
func NewNetConn ¶
NewNetConn creates a new instance of NetConn. Responder is invoked by Write when a frame is received. Return a nil slice/nil error to swallow the frame. Return a non-nil error to simulate a write error.
func (*NetConn) Read ¶
Read is invoked by conn.connReader to recieve frame data. It blocks until Write or Close are called, or the read deadline expires which will return an error.
func (*NetConn) RemoteAddr ¶
func (*NetConn) SendFrame ¶
SendFrame sends the encoded frame to the client. Use this to send a frame at an arbitrary time.
func (*NetConn) SendKeepAlive ¶
func (n *NetConn) SendKeepAlive()
SendKeepAlive sends a keep-alive frame to the client.
func (*NetConn) SendMultiFrameTransfer ¶
func (n *NetConn) SendMultiFrameTransfer(channel uint16, linkHandle, deliveryID uint32, payload []byte, edit func(int, *frames.PerformTransfer)) error
SendMultiFrameTransfer splits payload into 32-byte chunks, encodes, and sends to the client. Payload must be big enough for at least two chunks.
func (*NetConn) Write ¶
Write is invoked by conn.connWriter when we're being sent frame data. Every call to Write will invoke the responder callback that must reply with one of three possibilities.
- an encoded frame and nil error
- a non-nil error to similate a write failure
- a nil slice and nil error indicating the frame should be ignored