Documentation
¶
Index ¶
- Constants
- func GetID(network, address string, seed int, logger zerolog.Logger) string
- func GetRLimit(logger zerolog.Logger) syscall.Rlimit
- func Resolve(network, address string, logger zerolog.Logger) (string, *gerr.GatewayDError)
- type Client
- type ClientInterface
- type Proxy
- type ProxyImpl
- func (pr *ProxyImpl) Connect(gconn gnet.Conn) *gerr.GatewayDError
- func (pr *ProxyImpl) Disconnect(gconn gnet.Conn) *gerr.GatewayDError
- func (pr *ProxyImpl) IsExhausted() bool
- func (pr *ProxyImpl) PassThrough(gconn gnet.Conn) *gerr.GatewayDError
- func (pr *ProxyImpl) Shutdown()
- func (pr *ProxyImpl) TryReconnect(client *Client) (*Client, *gerr.GatewayDError)
- type Server
- func (s *Server) IsRunning() bool
- func (s *Server) OnBoot(engine gnet.Engine) gnet.Action
- func (s *Server) OnClose(gconn gnet.Conn, err error) gnet.Action
- func (s *Server) OnOpen(gconn gnet.Conn) ([]byte, gnet.Action)
- func (s *Server) OnShutdown(engine gnet.Engine)
- func (s *Server) OnTick() (time.Duration, gnet.Action)
- func (s *Server) OnTraffic(gconn gnet.Conn) gnet.Action
- func (s *Server) Run() error
- func (s *Server) Shutdown()
- type Status
Constants ¶
View Source
const ( DefaultSeed = 1000 DefaultChunkSize = 4096 DefaultReceiveDeadline = 0 // 0 means no deadline (timeout) DefaultSendDeadline = 0 )
View Source
const ( Running Status = "running" Stopped Status = "stopped" DefaultTickInterval = 5 * time.Second DefaultPoolSize = 10 MinimumPoolSize = 2 DefaultBufferSize = 1 << 24 // 16777216 bytes )
View Source
const (
EmptyPoolCapacity int = 0
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
net.Conn
ReceiveBufferSize int
ReceiveChunkSize int
ReceiveDeadline time.Duration
SendDeadline time.Duration
ID string
Network string // tcp/udp/unix
Address string
// contains filtered or unexported fields
}
func (*Client) IsConnected ¶ added in v0.1.0
type ClientInterface ¶ added in v0.1.2
type ClientInterface interface {
Send(data []byte) (int, *gerr.GatewayDError)
Receive() (int, []byte, *gerr.GatewayDError)
Close()
IsConnected() bool
}
type Proxy ¶
type Proxy interface {
Connect(gconn gnet.Conn) *gerr.GatewayDError
Disconnect(gconn gnet.Conn) *gerr.GatewayDError
PassThrough(gconn gnet.Conn) *gerr.GatewayDError
TryReconnect(cl *Client) (*Client, *gerr.GatewayDError)
Shutdown()
IsExhausted() bool
}
type ProxyImpl ¶
type ProxyImpl struct {
Elastic bool
ReuseElasticClients bool
// ClientConfig is used for elastic proxy and reconnection
ClientConfig *Client
// contains filtered or unexported fields
}
func (*ProxyImpl) Disconnect ¶
func (pr *ProxyImpl) Disconnect(gconn gnet.Conn) *gerr.GatewayDError
func (*ProxyImpl) IsExhausted ¶ added in v0.1.0
func (*ProxyImpl) PassThrough ¶
func (pr *ProxyImpl) PassThrough(gconn gnet.Conn) *gerr.GatewayDError
func (*ProxyImpl) TryReconnect ¶ added in v0.1.0
func (pr *ProxyImpl) TryReconnect(client *Client) (*Client, *gerr.GatewayDError)
type Server ¶
type Server struct {
gnet.BuiltinEventEngine
Network string // tcp/udp/unix
Address string
Options []gnet.Option
SoftLimit uint64
HardLimit uint64
Status Status
TickInterval time.Duration
// contains filtered or unexported fields
}
func (*Server) OnShutdown ¶
Click to show internal directories.
Click to hide internal directories.