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 Client
- type Pool
- type PoolImpl
- func (p *PoolImpl) ClientIDs() []string
- func (p *PoolImpl) Close() error
- func (p *PoolImpl) ForEach(callback func(client *Client) error)
- func (p *PoolImpl) Pool() *sync.Map
- func (p *PoolImpl) Pop(id string) *Client
- func (p *PoolImpl) Put(client *Client) error
- func (p *PoolImpl) Shutdown()
- func (p *PoolImpl) Size() int
- type Proxy
- type ProxyImpl
- func (pr *ProxyImpl) Connect(gconn gnet.Conn) error
- func (pr *ProxyImpl) Disconnect(gconn gnet.Conn) error
- func (pr *ProxyImpl) PassThrough(gconn gnet.Conn, onIncomingTraffic, onOutgoingTraffic Traffic) error
- func (pr *ProxyImpl) Reconnect(cl *Client) *Client
- func (pr *ProxyImpl) Shutdown()
- func (pr *ProxyImpl) Size() int
- 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
- type Traffic
Constants ¶
View Source
const ( Running Status = "running" Stopped Status = "stopped" DefaultTickInterval = 5 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 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 int OnIncomingTraffic Traffic OnOutgoingTraffic Traffic // 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.