Documentation ¶
Index ¶
- func NewConnection(input InputStream, output OutputStream, options ...ConnectionOption) net.Conn
- type ConnectionOption
- type InboundRay
- type InputStream
- type Option
- type OutboundRay
- type OutputStream
- type Ray
- type RayStream
- type Stream
- func (s *Stream) Close() error
- func (s *Stream) CloseError()
- func (s *Stream) Peek(b *buf.Buffer)
- func (s *Stream) ReadMultiBuffer() (buf.MultiBuffer, error)
- func (s *Stream) ReadTimeout(timeout time.Duration) (buf.MultiBuffer, error)
- func (s *Stream) Size() uint64
- func (s *Stream) WriteMultiBuffer(data buf.MultiBuffer) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewConnection ¶
func NewConnection(input InputStream, output OutputStream, options ...ConnectionOption) net.Conn
NewConnection wraps a Ray into net.Conn.
Types ¶
type ConnectionOption ¶
type ConnectionOption func(*connection)
func ConnCloseSignal ¶
func ConnCloseSignal(s *signal.Notifier) ConnectionOption
func ConnLocalAddr ¶
func ConnLocalAddr(addr net.Addr) ConnectionOption
func ConnRemoteAddr ¶
func ConnRemoteAddr(addr net.Addr) ConnectionOption
type InboundRay ¶
type InboundRay interface { // InboundInput provides a stream to retrieve the request from client. // The inbound connection shall close the channel after the entire request // is received and put into the channel. InboundInput() OutputStream // InboundOutput provides a stream of data for the inbound connection to write // as response. The inbound connection shall write all the data from the // channel until it is closed. InboundOutput() InputStream }
InboundRay is a transport interface for inbound connections.
type InputStream ¶ added in v1.11.2
type Option ¶
type Option func(*directRay)
func WithDownlinkStatCounter ¶
func WithDownlinkStatCounter(c addInt64) Option
func WithUplinkStatCounter ¶
func WithUplinkStatCounter(c addInt64) Option
type OutboundRay ¶
type OutboundRay interface { // OutboundInput provides a stream for the input of the outbound connection. // The outbound connection shall write all the input until it is closed. OutboundInput() InputStream // OutboundOutput provides a stream to retrieve the response from the // outbound connection. The outbound connection shall close the channel // after all responses are received and put into the channel. OutboundOutput() OutputStream }
OutboundRay is a transport interface for outbound connections.
type OutputStream ¶ added in v1.11.2
type Ray ¶
type Ray interface { InboundRay OutboundRay }
Ray is an internal transport channel between inbound and outbound connection.
type Stream ¶ added in v1.11.2
type Stream struct {
// contains filtered or unexported fields
}
Stream is a sequential container for data in bytes.
func (*Stream) Close ¶ added in v1.11.2
Close closes the stream for writing. Read() still works until EOF.
func (*Stream) CloseError ¶
func (s *Stream) CloseError()
CloseError closes the Stream with error. Read() will return an error afterwards.
func (*Stream) ReadMultiBuffer ¶
func (s *Stream) ReadMultiBuffer() (buf.MultiBuffer, error)
ReadMultiBuffer reads data from the Stream.
func (*Stream) ReadTimeout ¶
ReadTimeout reads from the Stream with a specified timeout.
func (*Stream) WriteMultiBuffer ¶
func (s *Stream) WriteMultiBuffer(data buf.MultiBuffer) error
WriteMultiBuffer writes more data into the Stream.
Click to show internal directories.
Click to hide internal directories.