Documentation
¶
Index ¶
- type ClientInfo
- type ClientRegistry
- func (cr *ClientRegistry) GetByKey(key string) (ClientInfo, bool)
- func (cr *ClientRegistry) GetByRunID(runID string) (ClientInfo, bool)
- func (cr *ClientRegistry) List() []ClientInfo
- func (cr *ClientRegistry) MarkOfflineByRunID(runID string)
- func (cr *ClientRegistry) Register(user, rawClientID, runID, hostname, remoteAddr string) (key string, conflict bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientInfo ¶
type ClientInfo struct {
Key string
User string
RawClientID string
RunID string
Hostname string
IP string
FirstConnectedAt time.Time
LastConnectedAt time.Time
DisconnectedAt time.Time
Online bool
}
ClientInfo captures metadata about a connected frpc instance.
func (ClientInfo) ClientID ¶
func (info ClientInfo) ClientID() string
ClientID returns the resolved client identifier for external use.
type ClientRegistry ¶
type ClientRegistry struct {
// contains filtered or unexported fields
}
ClientRegistry keeps track of active clients keyed by "{user}.{clientID}" (runID fallback when raw clientID is empty). Entries without an explicit raw clientID are removed on disconnect to avoid stale offline records.
func NewClientRegistry ¶
func NewClientRegistry() *ClientRegistry
func (*ClientRegistry) GetByKey ¶
func (cr *ClientRegistry) GetByKey(key string) (ClientInfo, bool)
GetByKey retrieves a client by its composite key ({user}.{clientID} with runID fallback).
func (*ClientRegistry) GetByRunID ¶
func (cr *ClientRegistry) GetByRunID(runID string) (ClientInfo, bool)
GetByRunID retrieves a client by its run ID.
func (*ClientRegistry) List ¶
func (cr *ClientRegistry) List() []ClientInfo
List returns a snapshot of all known clients.
func (*ClientRegistry) MarkOfflineByRunID ¶
func (cr *ClientRegistry) MarkOfflineByRunID(runID string)
MarkOfflineByRunID marks the client as offline when the corresponding control disconnects.
Click to show internal directories.
Click to hide internal directories.