Documentation ¶
Index ¶
Constants ¶
const MaxChunkSize int = 1024 * 16
MaxChunkSize is the maximum number of bytes to send in a single data message. According to https://github.com/grpc/grpc.github.io/issues/371 the optimal size is between 16KiB to 64KiB.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct { *ReadWriter // contains filtered or unexported fields }
Conn wraps ReadWriter in a net.Conn interface.
func (*Conn) RemoteAddr ¶
RemoteAddr is the address of the reverse tunnel node.
type ReadWriter ¶
type ReadWriter struct {
// contains filtered or unexported fields
}
ReadWriter wraps a grpc source with an io.ReadWriter interface. All reads are consumed from [Source.Recv] and all writes and sent via [Source.Send].
func NewReadWriter ¶
func NewReadWriter(source Source) (*ReadWriter, error)
NewReadWriter creates a new ReadWriter that leverages the provided source to retrieve data from and write data to.
func (*ReadWriter) Close ¶
func (c *ReadWriter) Close() error
Close cleans up resources used by the stream.
func (*ReadWriter) Read ¶
func (c *ReadWriter) Read(b []byte) (n int, err error)
Read returns data received from the stream source. Any data received from the stream that is not consumed will be buffered and returned on subsequent reads until there is none left. Only then will data be sourced from the stream again.
func (*ReadWriter) Write ¶
func (c *ReadWriter) Write(b []byte) (int, error)
Write consumes all data provided and sends it on the grpc stream. To prevent exhausting the stream all sends on the stream are limited to be at most MaxChunkSize. If the data exceeds the MaxChunkSize it will be sent in batches.