Documentation
¶
Index ¶
- func CloseCoreClient() error
- func EnsureRelayConnections() error
- func GetCoreClient() *core.Client
- func GetCoreClientStatus() map[string]interface{}
- func GetIndexRelays() []string
- func InitializeCoreClient(serverCfg *cfgType.ServerConfig) error
- func IsCoreClientInitialized() bool
- func SetIndexRelays(relays []string)
- func StartRelayHealthCheck(ctx context.Context, interval time.Duration)
- func SwitchToIndexRelays() error
- func SwitchToUserRelays(publicKey string) error
- func TopUpRelayConnections() (before, after int, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloseCoreClient ¶
func CloseCoreClient() error
CloseCoreClient closes the core client connections
func EnsureRelayConnections ¶
func EnsureRelayConnections() error
EnsureRelayConnections is the demand-side guard used by API/data callers that need at least one usable relay connection before issuing a query. It returns nil as soon as any relay is connected; if none are it forces a reconnect attempt against the full index-relay list. This is *not* the right primitive for filling a partial pool — see TopUpRelayConnections for that, and #68 for the production bug where confusing the two semantics let the upstream pool sit at 1/5 indefinitely.
func GetCoreClient ¶
GetCoreClient returns the core client instance
func GetCoreClientStatus ¶
func GetCoreClientStatus() map[string]interface{}
GetCoreClientStatus returns status information about the core client
func GetIndexRelays ¶ added in v0.5.0
func GetIndexRelays() []string
GetIndexRelays returns the configured index/seed relays
func InitializeCoreClient ¶
func InitializeCoreClient(serverCfg *cfgType.ServerConfig) error
InitializeCoreClient sets up the global core client with server configuration
func IsCoreClientInitialized ¶
func IsCoreClientInitialized() bool
IsCoreClientInitialized checks if the core client is properly initialized
func SetIndexRelays ¶ added in v0.5.0
func SetIndexRelays(relays []string)
SetIndexRelays sets the index/seed relays used for discovery
func StartRelayHealthCheck ¶ added in v0.5.0
StartRelayHealthCheck starts a background goroutine to maintain relay connections. It exits when ctx is cancelled so it doesn't outlive the server instance that started it (#93).
func SwitchToIndexRelays ¶ added in v0.5.0
func SwitchToIndexRelays() error
SwitchToIndexRelays switches the core client back to the configured index/seed relays — used when a session ends and per-user mailbox connections should be released.
func SwitchToUserRelays ¶ added in v0.4.12
SwitchToUserRelays switches the core client to use user's cached relays from mailboxes
func TopUpRelayConnections ¶ added in v0.5.4
TopUpRelayConnections attempts to bring the index-relay pool up to its configured target by dialing every relay that isn't currently connected. Already-connected relays are left alone (the pool's Connect is a no-op for them). Returns the (before, after) connection counts so the caller can log meaningfully — this exists because the health check previously logged "reconnection successful" whenever EnsureRelayConnections returned nil, which it does on any-connection-exists, regardless of whether the deficit was actually closed (#68).
Types ¶
This section is empty.