Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Addressable ¶
type CachedTCPWriter ¶
type CachedUDPWriter ¶
type Conn ¶
type Conn interface {
Response
RawWriteable
}
type Interceptor ¶
type Interceptor interface {
// OnReading handles reading event for tcp mode.
OnReading(ctx context.Context, conn Conn, data []byte, ch chan<- []byte) (processed bool, err error)
// OnWriting handles writing event for tcp mode.
//
// You may override the internal writing action with processed = true and
// write data yourself. For instance:
// processed = true
// c.RawWrite(data)
// By default, after OnWriting do nothing, internal loop will write data
// to tcp connection rawly.
OnWriting(ctx context.Context, conn Conn, data []byte) (processed bool, err error)
}
type InterceptorHolder ¶
type InterceptorHolder interface {
ProtocolInterceptor() Interceptor
}
type RawWriteable ¶
type RawWriteable interface {
// RawWrite does write through the internal net.Conn
RawWrite(ctx context.Context, message []byte) (n int, err error)
// RawWriteTimeout does write message immediately.
RawWriteTimeout(msg []byte, deadline ...time.Duration) (n int, err error)
}
RawWriteable provides instance writing feature without cache.
type ServerInterceptor ¶
type ServerInterceptorHolder ¶
type ServerInterceptorHolder interface {
ProtocolInterceptor() ServerInterceptor
}
type UdpInterceptor ¶
Click to show internal directories.
Click to hide internal directories.