Documentation
¶
Overview ¶
Package web provides web interface and proxy capabilities for Prism
Index ¶
- func ServeTerminalHTML(w http.ResponseWriter, r *http.Request)
- type AuthFunc
- type ConnectData
- type DashboardServer
- type InputData
- type InstanceProxy
- type LocalTerminal
- type OutputData
- type ProxyManager
- type ProxyStats
- type ResizeData
- type TerminalMessage
- type TerminalServer
- type TerminalSession
- type WebSocketProxy
- type WebSocketUpgrader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ServeTerminalHTML ¶
func ServeTerminalHTML(w http.ResponseWriter, r *http.Request)
ServeTerminalHTML serves the terminal HTML interface
Types ¶
type ConnectData ¶
type ConnectData struct {
InstanceID string `json:"instance_id"`
Host string `json:"host"`
Port int `json:"port"`
Username string `json:"username"`
}
ConnectData contains connection parameters
type DashboardServer ¶
type DashboardServer struct {
// contains filtered or unexported fields
}
DashboardServer provides a web dashboard for Prism
func NewDashboardServer ¶
func NewDashboardServer( instanceFunc func() ([]*types.Instance, error), templateFunc func() (map[string]types.RuntimeTemplate, error), proxyManager *ProxyManager, ) *DashboardServer
NewDashboardServer creates a new dashboard server
func (*DashboardServer) ServeHTTP ¶
func (ds *DashboardServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler
type InputData ¶
type InputData struct {
Data string `json:"data"`
}
InputData contains terminal input
type InstanceProxy ¶
type InstanceProxy struct {
InstanceID string
InstanceName string
TargetURL *url.URL
Proxy *httputil.ReverseProxy
Created time.Time
LastAccessed time.Time
AccessCount int64
}
InstanceProxy represents a proxy to an instance's web service
type LocalTerminal ¶
type LocalTerminal struct {
// contains filtered or unexported fields
}
LocalTerminal provides local terminal execution (for development)
func NewLocalTerminal ¶
func NewLocalTerminal() (*LocalTerminal, error)
NewLocalTerminal creates a new local terminal
type OutputData ¶
type OutputData struct {
Data string `json:"data"`
}
OutputData contains terminal output
type ProxyManager ¶
type ProxyManager struct {
// contains filtered or unexported fields
}
ProxyManager manages web proxies for instance services
func NewProxyManager ¶
func NewProxyManager(authFunc AuthFunc) *ProxyManager
NewProxyManager creates a new proxy manager
func (*ProxyManager) GetProxyStats ¶
func (pm *ProxyManager) GetProxyStats() map[string]ProxyStats
GetProxyStats returns statistics for all proxies
func (*ProxyManager) RegisterInstance ¶
func (pm *ProxyManager) RegisterInstance(instance *types.Instance) error
RegisterInstance registers a new instance for proxying
func (*ProxyManager) ServeHTTP ¶
func (pm *ProxyManager) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler for the proxy manager
func (*ProxyManager) UnregisterInstance ¶
func (pm *ProxyManager) UnregisterInstance(instanceID string) error
UnregisterInstance removes an instance from proxying
type ProxyStats ¶
type ProxyStats struct {
InstanceID string `json:"instance_id"`
InstanceName string `json:"instance_name"`
TargetURL string `json:"target_url"`
Created time.Time `json:"created"`
LastAccessed time.Time `json:"last_accessed"`
AccessCount int64 `json:"access_count"`
}
ProxyStats contains statistics for a proxy
type ResizeData ¶
ResizeData contains terminal resize parameters
type TerminalMessage ¶
type TerminalMessage struct {
Type string `json:"type"` // connect, resize, input, output, error, close
Data json.RawMessage `json:"data"`
}
TerminalMessage represents a message between client and server
type TerminalServer ¶
type TerminalServer struct {
// contains filtered or unexported fields
}
TerminalServer provides web-based terminal access to instances
func NewTerminalServer ¶
func NewTerminalServer(sshConfig *ssh.ClientConfig) *TerminalServer
NewTerminalServer creates a new terminal server
func (*TerminalServer) ServeHTTP ¶
func (ts *TerminalServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles terminal WebSocket connections
type TerminalSession ¶
type TerminalSession struct {
ID string
InstanceID string
SSHClient *ssh.Client
Session *ssh.Session
StdinPipe io.WriteCloser
StdoutPipe io.Reader
StderrPipe io.Reader
Connected bool
}
TerminalSession represents an active terminal session
type WebSocketProxy ¶
type WebSocketProxy struct {
// contains filtered or unexported fields
}
WebSocketProxy handles WebSocket proxying for instances
func NewWebSocketProxy ¶
func NewWebSocketProxy(targetURL string) (*WebSocketProxy, error)
NewWebSocketProxy creates a new WebSocket proxy
func (*WebSocketProxy) ServeHTTP ¶
func (wp *WebSocketProxy) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP handles WebSocket proxy requests using gorilla/websocket
func (*WebSocketProxy) ServeHTTPOld ¶
func (wp *WebSocketProxy) ServeHTTPOld(w http.ResponseWriter, r *http.Request)
ServeHTTPOld handles WebSocket proxy requests (old hijacking implementation)
type WebSocketUpgrader ¶
WebSocketUpgrader handles WebSocket upgrade