web

package
v0.0.0-...-1c5d739 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 14, 2023 License: Apache-2.0 Imports: 58 Imported by: 2

Documentation

Overview

Copyright 2016 The Serviced Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2016 The Serviced Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var ErrPortServerRunning = errors.New("port server is already running")

Functions

func GetCertFiles

func GetCertFiles(certFile, keyFile string) (string, string)

GetCertFiles returns the cert and key file if none is specified

func GetRemoteConnection

func GetRemoteConnection(useTLS bool, export *registry.ExportDetails) (remote net.Conn, err error)

GetRemoteConnection returns a connection to a remote address

func GetReverseProxy

func GetReverseProxy(useTLS bool, export *registry.ExportDetails) *httputil.ReverseProxy

GetReverseProxy acquires a reverse proxy from the cache if it exists or creates it if it is not found.

func IsLocalAddress

func IsLocalAddress(ip string) bool

IsLocalAddress returns true if the ip address is available on this host

func RestBackupCheck

func RestBackupCheck(w *rest.ResponseWriter, r *rest.Request, client *daoclient.ControlClient)

func RestBackupCreate

func RestBackupCreate(w *rest.ResponseWriter, r *rest.Request, client *daoclient.ControlClient)

func RestBackupFileList

func RestBackupFileList(w *rest.ResponseWriter, r *rest.Request, client *daoclient.ControlClient)

RestBackupFileList implements a rest call that will return a list of the current backup files. The return value is a JSON struct of type JsonizableFileInfo.

func RestBackupRestore

func RestBackupRestore(w *rest.ResponseWriter, r *rest.Request, client *daoclient.ControlClient)

func RestBackupStatus

func RestBackupStatus(w *rest.ResponseWriter, r *rest.Request, client *daoclient.ControlClient)

func RestRestoreStatus

func RestRestoreStatus(w *rest.ResponseWriter, r *rest.Request, client *daoclient.ControlClient)

func RouteOriginalURL

func RouteOriginalURL(r *http.Request)

If RawPath is given, Golang's url object has canonized the original URL. We want to route the original url instead, so set the Opaque property to allow any special characters that got translated. see: CC-3510

func ServeHTTP

func ServeHTTP(cancel <-chan struct{}, address, protocol string, listener net.Listener, tlsConfig *tls.Config, exports Exports)

ServeHTTP sets up an http server for handling a collection of endpoints

func ServeTCP

func ServeTCP(cancel <-chan struct{}, listener net.Listener, tlsConfig *tls.Config, exports Exports)

ServeTCP sets up a tcp based server connection given a set of exports.

func SetServiceStatsCacheTimeout

func SetServiceStatsCacheTimeout(seconds int)

SetServiceStatsCacheTimeout sets the time in seconds for stats on running instances to be cached for the UI.

Types

type Auth0Config

type Auth0Config struct {
	Auth0ClientID string
	Auth0Domain   string
	Auth0Audience string
	Auth0Scope    string
}

Auth0Config contains configuration values pertaining to Auth0

type ConciseServiceStatus

type ConciseServiceStatus struct {
	DockerID        string
	HostID          string
	ID              string
	InSync          bool
	InstanceID      int
	Instances       int
	Name            string
	ParentServiceID string
	PoolID          string
	ServiceID       string
	StartedAt       time.Time
	RAMMax          int64
	RAMLast         int64
	RAMAverage      int64
	RAMCommitment   utils.EngNotation
	HealthChecks    map[string]health.HealthStatus
}

ConciseServiceStatus contains the information necessary to display the status of a service in the UI. It joins running instances with health checks with memory stats. It does not include fields unnecessary for status display, such as config files or monitoring profiles.

type DeployTemplateStatusRequest

type DeployTemplateStatusRequest struct {
	DeploymentID string
	LastStatus   string
	Timeout      int
}

type Exports

type Exports interface {
	Set(data []registry.ExportDetails)
	Next() *registry.ExportDetails
}

Exports manage a list of available exports

type PublicPortHandler

type PublicPortHandler struct {
	// contains filtered or unexported fields
}

PublicPortHandler manages the port server at a specific port address

func NewPublicPortHandler

func NewPublicPortHandler(portAddr string, data ...registry.ExportDetails) *PublicPortHandler

NewPublicPortHandler sets up a new public port at the given port address

func (*PublicPortHandler) Serve

func (h *PublicPortHandler) Serve(protocol string, useTLS bool, certFile, keyFile string) error

Serve starts the port server at address

func (*PublicPortHandler) SetExports

func (h *PublicPortHandler) SetExports(data []registry.ExportDetails)

SetExports updates the export list for the port handler

func (*PublicPortHandler) Stop

func (h *PublicPortHandler) Stop()

Stop shuts down the port server

type PublicPortManager

type PublicPortManager struct {
	// contains filtered or unexported fields
}

PublicPortManager manages all the port servers for a particular host id

func NewPublicPortManager

func NewPublicPortManager(hostID, certFile, keyFile string, onFailure func(portAddr string, err error)) *PublicPortManager

NewPublicPortManager creates a new public port manager for a host id

func (*PublicPortManager) Disable

func (m *PublicPortManager) Disable(portAddr string)

Disable stops the public port server at the port address

func (*PublicPortManager) Enable

func (m *PublicPortManager) Enable(portAddr, protocol string, useTLS bool)

Enable implements starts the public port server at the port address

func (*PublicPortManager) Set

func (m *PublicPortManager) Set(portAddr string, data []registry.ExportDetails)

Set updates the exports for a particular port handler

type ReverseProxyCache

type ReverseProxyCache struct {
	// contains filtered or unexported fields
}

ReverseProxyCache keeps track of all available reverse proxies

func (*ReverseProxyCache) Get

func (cache *ReverseProxyCache) Get(hostAddress, privateAddress string, useTLS bool) (*httputil.ReverseProxy, bool)

Get retrieves a reverse proxy from the cache

func (*ReverseProxyCache) Set

func (cache *ReverseProxyCache) Set(hostAddress, privateAddress string, useTLS bool, rp *httputil.ReverseProxy)

Set sets an instantiated reverse proxy

type ReverseProxyKey

type ReverseProxyKey struct {
	HostAddress    string
	PrivateAddress string
	UseTLS         bool
}

ReverseProxyKey is the hash key to identify an instantiated reverse proxy

type RoundRobinExports

type RoundRobinExports struct {
	// contains filtered or unexported fields
}

RoundRobinExports returns the next export in a round-robin manner

func NewRoundRobinExports

func NewRoundRobinExports(data []registry.ExportDetails) *RoundRobinExports

NewRoundRobinExports creates a new round robin list of exports

func (*RoundRobinExports) Next

Next returns the next available export

func (*RoundRobinExports) Set

func (e *RoundRobinExports) Set(data []registry.ExportDetails)

Set updates the list of exports.

type ServiceConfig

type ServiceConfig struct {
	// contains filtered or unexported fields
}

ServiceConfig is the ui/rest handler for control center

func NewServiceConfig

func NewServiceConfig(bindPort string, agentPort string, stats bool, hostaliases []string, muxTLS bool, muxPort int,
	aGroup string, certPEMFile string, keyPEMFile string, pollFrequency int, configuredSnapshotSpacePercent int, facade facade.FacadeInterface) *ServiceConfig

NewServiceConfig creates a new ServiceConfig

func (*ServiceConfig) Serve

func (sc *ServiceConfig) Serve(shutdown <-chan (interface{}))

Serve handles control center web UI requests and virtual host requests for zenoss web based services. The UI server actually listens on port 7878, the uihandler defined here just reverse proxies to it. Virtual host routing to zenoss web based services is done by the publicendpointhandler function.

type TCPKeepAliveListener

type TCPKeepAliveListener struct {
	*net.TCPListener
	// contains filtered or unexported fields
}

TCPKeepAliveListener keeps a listener connection alive for the duration of a cancellable

func (TCPKeepAliveListener) Accept

func (ln TCPKeepAliveListener) Accept() (c net.Conn, err error)

Accept returns the connection to the listener

type UIConfig

type UIConfig struct {
	PollFrequency int
}

UIConfig contains configuration values that the UI may care about

type VHostHandler

type VHostHandler struct {
	// contains filtered or unexported fields
}

VHostHandler manages a vhost endpoint

func NewVHostHandler

func NewVHostHandler(data ...registry.ExportDetails) *VHostHandler

NewVHostHandler instantiates a new vhost handler

func (*VHostHandler) Disable

func (h *VHostHandler) Disable()

Disable disables a vhost endpoint

func (*VHostHandler) Enable

func (h *VHostHandler) Enable()

Enable enables a vhost endpoint

func (*VHostHandler) Handle

func (h *VHostHandler) Handle(useTLS bool, w http.ResponseWriter, r *http.Request) bool

Handle is the vhost handler, returns true if the vhost is enabled

func (*VHostHandler) SetExports

func (h *VHostHandler) SetExports(data []registry.ExportDetails)

SetExports updates exports for a vhost endpoint

type VHostManager

type VHostManager struct {
	// contains filtered or unexported fields
}

VHostManager manages all vhosts on a host

func NewVHostManager

func NewVHostManager(useTLS bool) *VHostManager

NewVHostManager creates a new vhost manager for a host

func (*VHostManager) Disable

func (m *VHostManager) Disable(name string)

Disable disables the vhost

func (*VHostManager) Enable

func (m *VHostManager) Enable(name string)

Enable implements enables the vhost

func (*VHostManager) Handle

func (m *VHostManager) Handle(httphost string, w http.ResponseWriter, r *http.Request) bool

Handle manages a vhost request and returns true if the vhost is enabled

func (*VHostManager) Set

func (m *VHostManager) Set(name string, data []registry.ExportDetails)

Set updates the vhost endpoints

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL