Documentation ¶
Index ¶
- Constants
- func ConfigHandler(w http.ResponseWriter, r *http.Request) (int, error)
- func CreateAttachHandler(path string) http.Handler
- func CreateHTTPAPIHandler(iManager integration.IntegrationManager, cManager clientapi.ClientManager, ...) (http.Handler, error)
- func InstallFilters(ws *restful.WebService, manager clientapi.ClientManager)
- func MakeGzipHandler(handler http.Handler) http.Handler
- func WaitForTerminal(k8sClient kubernetes.Interface, cfg *rest.Config, request *restful.Request, ...)
- type APIHandler
- type AppConfig
- type AppHandler
- type LocaleHandler
- type Localization
- type PtyHandler
- type SessionMap
- type TerminalMessage
- type TerminalResponse
- type TerminalSession
Constants ¶
const ( // RequestLogString is a template for request log message. RequestLogString = "[%s] Incoming %s %s %s request from %s: %s" // ResponseLogString is a template for response log message. ResponseLogString = "[%s] Outcoming response to %s with %d status code" )
const ( // ConfigTemplateName is a name of config template ConfigTemplateName = "appConfig" // ConfigTemplate is a template of a config ConfigTemplate = "{{.}}" )
const END_OF_TRANSMISSION = "\u0004"
Variables ¶
This section is empty.
Functions ¶
func ConfigHandler ¶
func CreateAttachHandler ¶ added in v1.6.2
CreateAttachHandler is called from main for /api/sockjs
func CreateHTTPAPIHandler ¶ added in v1.1.1
func CreateHTTPAPIHandler(iManager integration.IntegrationManager, cManager clientapi.ClientManager, authManager authApi.AuthManager, sManager settings.SettingsManager, sbManager systembanner.SystemBannerManager) ( http.Handler, error)
CreateHTTPAPIHandler creates a new HTTP handler that handles all requests to the API of the backend.
func InstallFilters ¶ added in v1.6.2
func InstallFilters(ws *restful.WebService, manager clientapi.ClientManager)
InstallFilters installs defined filter for given web service
func MakeGzipHandler ¶ added in v1.1.1
MakeGzipHandler adds support for gzip compression for given handler
func WaitForTerminal ¶ added in v1.6.2
func WaitForTerminal(k8sClient kubernetes.Interface, cfg *rest.Config, request *restful.Request, sessionId string)
WaitForTerminal is called from apihandler.handleAttach as a goroutine Waits for the SockJS connection to be opened by the client the session to be bound in handleTerminalSession
Types ¶
type APIHandler ¶ added in v1.1.1
type APIHandler struct {
// contains filtered or unexported fields
}
APIHandler is a representation of API handler. Structure contains clientapi, Heapster clientapi and clientapi configuration.
type AppConfig ¶
type AppConfig struct { // ServerTime is current server time. ServerTime int64 `json:"serverTime"` }
AppConfig is a global configuration of application.
type AppHandler ¶
AppHandler is an application handler.
func (AppHandler) ServeHTTP ¶
func (fn AppHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP serves HTTP endpoint with application configuration.
type LocaleHandler ¶
LocaleHandler serves different localized versions of the frontend application based on the Accept-Language header.
func CreateLocaleHandler ¶
func CreateLocaleHandler() *LocaleHandler
CreateLocaleHandler loads the localization configuration and constructs a LocaleHandler.
func (*LocaleHandler) ServeHTTP ¶
func (handler *LocaleHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
LocaleHandler serves different html versions based on the Accept-Language header.
type Localization ¶
type Localization struct {
Translations []string `json:"translations"`
}
Localization is a spec for the localization configuration of dashboard.
type PtyHandler ¶ added in v1.6.2
type PtyHandler interface { io.Reader io.Writer remotecommand.TerminalSizeQueue }
PtyHandler is what remotecommand expects from a pty
type SessionMap ¶ added in v1.10.2
type SessionMap struct { Sessions map[string]TerminalSession Lock sync.RWMutex }
SessionMap stores a map of all TerminalSession objects and a lock to avoid concurrent conflict
func (SessionMap) Close ¶ added in v1.10.2
func (sm SessionMap) Close(sessionId string, status uint32, reason string)
Close shuts down the SockJS connection and sends the status code and reason to the client Can happen if the process exits or if there is an error starting up the process For now the status code is unused and reason is shown to the user (unless "")
func (SessionMap) Get ¶ added in v1.10.2
func (sm SessionMap) Get(sessionId string) TerminalSession
Get return a given terminalSession by sessionId
func (SessionMap) Set ¶ added in v1.10.2
func (sm SessionMap) Set(sessionId string, session TerminalSession)
Set store a TerminalSession to SessionMap
type TerminalMessage ¶ added in v1.6.2
TerminalMessage is the messaging protocol between ShellController and TerminalSession.
OP DIRECTION FIELD(S) USED DESCRIPTION --------------------------------------------------------------------- bind fe->be SessionID Id sent back from TerminalResponse stdin fe->be Data Keystrokes/paste buffer resize fe->be Rows, Cols New terminal size stdout be->fe Data Output from the process toast be->fe Data OOB message to be shown to the user
type TerminalResponse ¶ added in v1.6.2
type TerminalResponse struct {
Id string `json:"id"`
}
TerminalResponse is sent by handleExecShell. The Id is a random session id that binds the original REST request and the SockJS connection. Any clientapi in possession of this Id can hijack the terminal session.
type TerminalSession ¶ added in v1.6.2
type TerminalSession struct {
// contains filtered or unexported fields
}
TerminalSession implements PtyHandler (using a SockJS connection)
func (TerminalSession) Next ¶ added in v1.6.2
func (t TerminalSession) Next() *remotecommand.TerminalSize
TerminalSize handles pty->process resize events Called in a loop from remotecommand as long as the process is running
func (TerminalSession) Read ¶ added in v1.6.2
func (t TerminalSession) Read(p []byte) (int, error)
Read handles pty->process messages (stdin, resize) Called in a loop from remotecommand as long as the process is running
func (TerminalSession) Toast ¶ added in v1.6.2
func (t TerminalSession) Toast(p string) error
Toast can be used to send the user any OOB messages hterm puts these in the center of the terminal