Documentation
¶
Index ¶
- type Client
- type Hub
- func (h *Hub) MigrateServerContainer(serverID, newContainerID string)
- func (h *Hub) Run()
- func (h *Hub) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (h *Hub) SetCheckOrigin(check func(r *http.Request) bool)
- func (h *Hub) SetOriginPolicy(allow []string, trustProxy bool)
- func (h *Hub) SetPool(pool *docker.ClientPool)
- func (h *Hub) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents a single WebSocket connection
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub manages WebSocket connections and log subscriptions
func NewHub ¶
func NewHub(logStreamer *logger.LogStreamer, authManager *auth.Manager, enforcer *rbac.Enforcer, store *storage.Store, docker *docker.Client, sender *command.Sender, log *logger.Logger) *Hub
NewHub creates a new WebSocket hub
func (*Hub) MigrateServerContainer ¶
MigrateServerContainer re-points every live subscription for serverID at the container's new ID (MINE-108). Without this, a client that subscribed before a container recreation keeps the old containerID, so a later unsubscribe or disconnect cleanup asks the LogStreamer to close a channel under a key it no longer knows about — leaking the channel and its forwarder goroutine.
It is called by the reconciler once it has observed (or performed) a recreation, and is a no-op for clients with no subscription for serverID.
func (*Hub) ServeHTTP ¶
func (h *Hub) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles WebSocket upgrade requests
func (*Hub) SetCheckOrigin ¶
SetCheckOrigin overrides the WebSocket upgrader origin validation function.
func (*Hub) SetOriginPolicy ¶
SetOriginPolicy sets the browser origins that may open a console socket. An empty allowlist keeps same-host checks. X-Forwarded-Host is ignored unless trustProxy is set. A missing Origin header stays allowed for CLI clients.
func (*Hub) SetPool ¶
func (h *Hub) SetPool(pool *docker.ClientPool)
SetPool sets the Docker client pool for multi-node support.