Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Wire ¶
type Wire struct {
// contains filtered or unexported fields
}
A Wire is allows communicating length-delimited bytes to and from the network or a buffer, up until some predefined maximum message length.
func (*Wire) IsNextMessageAllowed ¶
IsNextMessageAllowed will check if the next message is permitted by the rate limiter. It will wait for a new message to be available on the stream reader by peeking at the first 4 bytes representing the new message's length. If the rate limiter rejects the request, the rejected message is consumed from the reader and discarded. This way the sync with the sender is not broken.
func (*Wire) ReadOneFromWire ¶
NOTE: This can block indefinitely if not enough bytes are forthcoming It can error if the stream unexpectedly closes, or the provided data is invalid