Documentation ¶
Index ¶
- func NewClient(ctx *gonet.Context, options ...Option) gonet.IClient
- func NewServer(ctx *gonet.Context, options ...Option) gonet.IServer
- func SessionType() reflect.Type
- type LoadBalancing
- type Option
- func WithLoadBalancing(lb LoadBalancing) Option
- func WithLockOSThread(lockOSThread bool) Option
- func WithMulticastInterfaceIndex(idx int) Option
- func WithMulticore(multicore bool) Option
- func WithNumEventLoop(numEventLoop int) Option
- func WithReadBufferCap(readBufferCap int) Option
- func WithReuseAddr(reuseAddr bool) Option
- func WithReusePort(reusePort bool) Option
- func WithSocketRecvBuffer(recvBuf int) Option
- func WithSocketSendBuffer(sendBuf int) Option
- func WithTCPKeepAlive(tcpKeepAlive time.Duration) Option
- func WithTCPNoDelay(tcpNoDelay TCPSocketOpt) Option
- func WithTicker(ticker bool) Option
- func WithWriteBufferCap(writeBufferCap int) Option
- type TCPSocketOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SessionType ¶
Types ¶
type LoadBalancing ¶
type LoadBalancing int
LoadBalancing represents the type of load-balancing algorithm.
const ( // RoundRobin assigns the next accepted connection to the event-loop by polling event-loop list. RoundRobin LoadBalancing = iota // LeastConnections assigns the next accepted connection to the event-loop that is // serving the least number of active connections at the current time. LeastConnections // SourceAddrHash assigns the next accepted connection to the event-loop by hashing the remote address. SourceAddrHash )
type Option ¶
type Option func(*option)
func WithLoadBalancing ¶
func WithLoadBalancing(lb LoadBalancing) Option
WithLoadBalancing sets up the load-balancing algorithm in gnet engine.
func WithLockOSThread ¶
WithLockOSThread sets up LockOSThread mode for I/O event-loops.
func WithMulticastInterfaceIndex ¶
WithMulticastInterfaceIndex sets the interface name where UDP multicast sockets will be bound to.
func WithMulticore ¶
WithMulticore sets up multi-cores in gnet engine.
func WithNumEventLoop ¶
WithNumEventLoop sets up NumEventLoop in gnet engine.
func WithReadBufferCap ¶
WithReadBufferCap sets up ReadBufferCap for reading bytes.
func WithReuseAddr ¶
WithReuseAddr sets up SO_REUSEADDR socket option.
func WithReusePort ¶
WithReusePort sets up SO_REUSEPORT socket option.
func WithSocketRecvBuffer ¶
WithSocketRecvBuffer sets the maximum socket receive buffer in bytes.
func WithSocketSendBuffer ¶
WithSocketSendBuffer sets the maximum socket send buffer in bytes.
func WithTCPKeepAlive ¶
WithTCPKeepAlive sets up the SO_KEEPALIVE socket option with duration.
func WithTCPNoDelay ¶
func WithTCPNoDelay(tcpNoDelay TCPSocketOpt) Option
WithTCPNoDelay enable/disable the TCP_NODELAY socket option.
func WithWriteBufferCap ¶
WithWriteBufferCap sets up WriteBufferCap for pending bytes.
type TCPSocketOpt ¶
type TCPSocketOpt int
TCPSocketOpt is the type of TCP socket options.
const ( TCPNoDelay TCPSocketOpt = iota TCPDelay )
Available TCP socket options.