registry

package
v0.67.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

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.

func (*ClientRegistry) Register

func (cr *ClientRegistry) Register(user, rawClientID, runID, hostname, remoteAddr string) (key string, conflict bool)

Register stores/updates metadata for a client and returns the registry key plus whether it conflicts with an online client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL