Documentation ¶
Index ¶
- type Client
- type Config
- type Context
- func (c *Context) Cancel()
- func (c *Context) Deadline() (deadline time.Time, ok bool)
- func (c *Context) Done() <-chan struct{}
- func (c *Context) Err() error
- func (c *Context) LocalAddr() net.Addr
- func (c *Context) Read(p []byte) (n int, err error)
- func (c *Context) RemoteAddr() net.Addr
- func (c *Context) Value(key any) any
- func (c *Context) Write(p []byte) (n int, err error)
- type HandleFunc
- type Option
- func WithAfterClosing(afterClosing func(address string)) Option
- func WithAfterHandling(afterHandling func(ctx *Context)) Option
- func WithAfterServing(afterServing func(address string)) Option
- func WithBeforeClosing(beforeClosing func(address string)) Option
- func WithBeforeHandling(beforeHandling func(ctx *Context)) Option
- func WithBeforeServing(beforeServing func(address string)) Option
- func WithCloseTimeout(timeout time.Duration) Option
- func WithConnectTimeout(timeout time.Duration) Option
- func WithMaxConnections(maxConnections uint32) Option
- func WithName(name string) Option
- func WithOnConnected(onConnected func(clientAddress string, serverAddress string)) Option
- func WithOnDisconnected(onDisconnected func(clientAddress string, serverAddress string)) Option
- func WithReadBufferSize(bufferSize uint32) Option
- func WithReadTimeout(timeout time.Duration) Option
- func WithWriteBufferSize(bufferSize uint32) Option
- func WithWriteTimeout(timeout time.Duration) Option
- type Server
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { io.ReadWriteCloser }
type Config ¶ added in v0.4.2
type Config struct {
// contains filtered or unexported fields
}
func (*Config) ApplyOptions ¶ added in v0.4.2
type Context ¶ added in v0.4.2
type Context struct {
// contains filtered or unexported fields
}
Context connects client and server which can be read and written.
func (*Context) Deadline ¶ added in v0.4.2
Deadline returns the time when context has done. See context.Context.
func (*Context) Done ¶ added in v0.4.2
func (c *Context) Done() <-chan struct{}
Done returns a channel that's closed when context has done. See context.Context.
func (*Context) RemoteAddr ¶ added in v0.4.2
RemoteAddr returns the remote network address.
type HandleFunc ¶ added in v0.4.2
type HandleFunc func(ctx *Context)
HandleFunc is a function for handling connected context. You should design your own handler function for your server.
type Option ¶ added in v0.4.2
type Option func(conf *Config)
func WithAfterClosing ¶ added in v0.4.2
WithAfterClosing sets after closing function to config.
func WithAfterHandling ¶ added in v0.4.2
WithAfterHandling sets after handling function to config.
func WithAfterServing ¶ added in v0.4.2
WithAfterServing sets after serving function to config.
func WithBeforeClosing ¶ added in v0.4.2
WithBeforeClosing sets before closing function to config.
func WithBeforeHandling ¶ added in v0.4.2
WithBeforeHandling sets before handling function to config.
func WithBeforeServing ¶ added in v0.4.2
WithBeforeServing sets before serving function to config.
func WithCloseTimeout ¶ added in v0.4.2
WithCloseTimeout sets close timeout to config.
func WithConnectTimeout ¶ added in v0.4.2
WithConnectTimeout sets connect timeout to config.
func WithMaxConnections ¶ added in v0.4.2
WithMaxConnections sets max connections to config.
func WithOnConnected ¶ added in v0.4.2
WithOnConnected sets on connected function to config.
func WithOnDisconnected ¶ added in v0.4.2
WithOnDisconnected sets on disconnected function to config.
func WithReadBufferSize ¶ added in v0.4.2
WithReadBufferSize sets read buffer size to config.
func WithReadTimeout ¶ added in v0.4.2
WithReadTimeout sets read timeout to config.
func WithWriteBufferSize ¶ added in v0.4.2
WithWriteBufferSize sets write buffer size to config.
func WithWriteTimeout ¶ added in v0.4.2
WithWriteTimeout sets write timeout to config.