Documentation
¶
Index ¶
- Constants
- type BaseClient
- func (c *BaseClient) DefaultDialog() (xnet.ClientDialog, bool)
- func (c *BaseClient) Dialog(dialogID uint64) (xnet.ClientDialog, bool)
- func (c *BaseClient) Start(ctx context.Context) (err error)
- func (c *BaseClient) Stop(ctx context.Context) (err error)
- func (c *BaseClient) Target() string
- func (c *BaseClient) WalkDialogs(fn func(dialog xnet.ClientDialog))
- type BaseServer
- func (s *BaseServer) Broadcast(ctx context.Context, color string, sid int64, pack xnet.Pack) (err error)
- func (s *BaseServer) Disconnect(ctx context.Context, wid uint64) error
- func (s *BaseServer) Endpoint() (*url.URL, error)
- func (s *BaseServer) Multicast(ctx context.Context, uids []int64, pack xnet.Pack) (err error)
- func (s *BaseServer) Push(ctx context.Context, uid int64, pack xnet.Pack) error
- func (s *BaseServer) Start(ctx context.Context) error
- func (s *BaseServer) Stop(ctx context.Context) (err error)
- func (s *BaseServer) WIDList() []uint64
- type ConnCarrier
- type ConnIDGenerator
- type CreateTunnelFunc
- type Dialer
- type Dialog
- type Listener
- type Tunnel
- type Worker
- func (w *Worker) Color() string
- func (w *Worker) Conn() net.Conn
- func (w *Worker) Connected() bool
- func (w *Worker) Endpoint() string
- func (w *Worker) Push(ctx context.Context, out xnet.Pack) error
- func (w *Worker) Run(ctx context.Context) error
- func (w *Worker) SID() int64
- func (w *Worker) Session() xnet.Session
- func (w *Worker) Start(ctx context.Context) (err error)
- func (w *Worker) Status() int64
- func (w *Worker) Stop(ctx context.Context) (err error)
- func (w *Worker) Tunnel(ctx context.Context, mod int32, oid int64) (t xnet.Tunnel, err error)
- func (w *Worker) UID() int64
- func (w *Worker) WID() uint64
- type WorkerManager
- func (m *WorkerManager) Del(wid uint64)
- func (m *WorkerManager) GetByUID(uid int64) *Worker
- func (m *WorkerManager) GetByUIDs(uids []int64) map[int64]*Worker
- func (m *WorkerManager) Put(w *Worker) (old *Worker)
- func (m *WorkerManager) Walk(f func(w *Worker) bool)
- func (m *WorkerManager) Worker(wid uint64) *Worker
Constants ¶
View Source
const ( NetTypeTCP = iota NetTypeWebSocket NetTypeKCP )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseClient ¶ added in v0.0.25
func NewBaseClient ¶ added in v0.0.25
func NewBaseClient(id int64, handshakePack client.HandshakePackFunc, dialer Dialer, options *client.Options) *BaseClient
func (*BaseClient) DefaultDialog ¶ added in v0.0.27
func (c *BaseClient) DefaultDialog() (xnet.ClientDialog, bool)
func (*BaseClient) Dialog ¶ added in v0.0.27
func (c *BaseClient) Dialog(dialogID uint64) (xnet.ClientDialog, bool)
func (*BaseClient) Start ¶ added in v0.0.25
func (c *BaseClient) Start(ctx context.Context) (err error)
func (*BaseClient) Stop ¶ added in v0.0.25
func (c *BaseClient) Stop(ctx context.Context) (err error)
func (*BaseClient) Target ¶ added in v0.0.25
func (c *BaseClient) Target() string
func (*BaseClient) WalkDialogs ¶ added in v0.0.26
func (c *BaseClient) WalkDialogs(fn func(dialog xnet.ClientDialog))
type BaseServer ¶ added in v0.0.25
type BaseServer struct {
xsync.Stoppable
*server.Options
// contains filtered or unexported fields
}
func NewBaseServer ¶ added in v0.0.25
func (*BaseServer) Disconnect ¶ added in v0.0.25
func (s *BaseServer) Disconnect(ctx context.Context, wid uint64) error
func (*BaseServer) Stop ¶ added in v0.0.25
func (s *BaseServer) Stop(ctx context.Context) (err error)
func (*BaseServer) WIDList ¶ added in v0.0.25
func (s *BaseServer) WIDList() []uint64
type ConnCarrier ¶ added in v0.0.28
func NewConnCarrier ¶ added in v0.0.28
func (ConnCarrier) Close ¶ added in v0.0.28
func (c ConnCarrier) Close() error
type ConnIDGenerator ¶ added in v0.0.26
type ConnIDGenerator struct {
// contains filtered or unexported fields
}
func NewConnIDGenerator ¶ added in v0.0.26
func NewConnIDGenerator(netType int) *ConnIDGenerator
func (*ConnIDGenerator) Next ¶ added in v0.0.26
func (g *ConnIDGenerator) Next() uint64
type CreateTunnelFunc ¶
type Dialer ¶ added in v0.0.25
type Dialer interface {
// Dial establishes a connection to the target
Dial(ctx context.Context, target string) (conns []ConnCarrier, err error)
// Stop stops the dialer
Stop(ctx context.Context) error
// Target returns the target address/URL for this dialer
Target() string
}
Dialer defines the interface for protocol-specific connection dialing
type Dialog ¶ added in v0.0.26
func (*Dialog) WaitAuthed ¶ added in v0.0.26
func (d *Dialog) WaitAuthed()
type Listener ¶ added in v0.0.25
type Listener interface {
// Start starts the listener and begins accepting connections
Start(ctx context.Context) error
// Stop stops the listener gracefully
Stop(ctx context.Context) error
// Accept accepts a new connection and returns it as net.Conn
Accept(ctx context.Context) (ConnCarrier, error)
// Endpoint returns the endpoint URL for this listener
Endpoint() (string, error)
}
Listener defines the interface for protocol-specific connection handling
type WorkerManager ¶ added in v0.0.7
type WorkerManager struct {
// contains filtered or unexported fields
}
func (*WorkerManager) Del ¶ added in v0.0.7
func (m *WorkerManager) Del(wid uint64)
func (*WorkerManager) GetByUID ¶ added in v0.0.7
func (m *WorkerManager) GetByUID(uid int64) *Worker
func (*WorkerManager) GetByUIDs ¶ added in v0.0.7
func (m *WorkerManager) GetByUIDs(uids []int64) map[int64]*Worker
func (*WorkerManager) Put ¶ added in v0.0.7
func (m *WorkerManager) Put(w *Worker) (old *Worker)
func (*WorkerManager) Walk ¶ added in v0.0.7
func (m *WorkerManager) Walk(f func(w *Worker) bool)
func (*WorkerManager) Worker ¶ added in v0.0.7
func (m *WorkerManager) Worker(wid uint64) *Worker
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package ip provides utilities for IP address operations, including detection of internal IPs, extracting addresses from connections, and client IP identification in request contexts.
|
Package ip provides utilities for IP address operations, including detection of internal IPs, extracting addresses from connections, and client IP identification in request contexts. |
Click to show internal directories.
Click to hide internal directories.