Documentation ¶
Index ¶
- Constants
- Variables
- 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, error)
- type Callback
- type Client
- type HookConfig
- type HookDef
- type HookType
- type Policy
- type Pool
- type PoolImpl
- type Prio
- type Proxy
- type ProxyImpl
- 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 Signature
- type Status
Constants ¶
View Source
const ( Running Status = "running" Stopped Status = "stopped" DefaultTickInterval = 5 * time.Second DefaultPoolSize = 10 DefaultBufferSize = 4096 )
View Source
const (
DefaultSeed = 1000
)
Variables ¶
Functions ¶
Types ¶
type Client ¶
type Client struct { net.Conn ID string ReceiveBufferSize int Network string // tcp/udp/unix Address string // contains filtered or unexported fields }
type HookConfig ¶ added in v0.0.6
type HookConfig struct { Logger zerolog.Logger Verification Policy // contains filtered or unexported fields }
func NewHookConfig ¶ added in v0.0.6
func NewHookConfig() *HookConfig
func (*HookConfig) Add ¶ added in v0.0.7
func (h *HookConfig) Add(hookType HookType, prio Prio, hook HookDef)
type HookType ¶ added in v0.0.6
type HookType string
const ( // Run command hooks (cmd/run.go). OnConfigLoaded HookType = "onConfigLoaded" OnNewLogger HookType = "onNewLogger" OnNewPool HookType = "onNewPool" OnNewProxy HookType = "onNewProxy" OnNewServer HookType = "onNewServer" OnSignal HookType = "onSignal" // Server hooks (network/server.go). OnRun HookType = "onRun" OnBooting HookType = "onBooting" OnBooted HookType = "onBooted" OnOpening HookType = "onOpening" OnOpened HookType = "onOpened" OnClosing HookType = "onClosing" OnClosed HookType = "onClosed" OnTraffic HookType = "onTraffic" OnIngressTraffic HookType = "onIngressTraffic" OnEgressTraffic HookType = "onEgressTraffic" OnShutdown HookType = "onShutdown" OnTick HookType = "onTick" // Pool hooks (network/pool.go). OnNewClient HookType = "onNewClient" )
type Pool ¶
type Pool interface { ForEach(Callback) Pool() *sync.Map Put(key, value interface{}) Get(key interface{}) interface{} Pop(key interface{}) interface{} Size() int Clear() }
func NewEmptyPool ¶ added in v0.0.6
type Prio ¶ added in v0.0.6
type Prio uint
Prio is the priority of a hook. Smaller values are executed first (higher priority).
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 (*ProxyImpl) PassThrough ¶
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 ¶
func (s *Server) OnShutdown(engine gnet.Engine)
Click to show internal directories.
Click to hide internal directories.