khatru: relay stats.

This commit is contained in:
fiatjaf
2026-03-29 22:18:51 -03:00
parent ac2d4579f1
commit 117a304f68
+12
View File
@@ -190,3 +190,15 @@ func (rl *Relay) getBaseURL(r *http.Request) string {
return proto + "://" + host + r.URL.Path
}
// Stats returns the current number of connected clients and open listeners.
func (rl *Relay) Stats() (clients, listeners int) {
rl.clientsMutex.Lock()
defer rl.clientsMutex.Unlock()
for _, specs := range rl.clients {
listeners += len(specs)
}
return len(rl.clients), listeners
}