server

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_CERT_FILE = "default.crt"
	DEFAULT_KEY_FILE  = "default.key"
)
View Source
const (
	REALM = "clace"
)
View Source
const (
	VARY_HEADER = "Vary"
)

Variables

View Source
var CL_HOME = os.ExpandEnv("$CL_HOME")

CL_HOME is the root directory for Clace logs and temp files

View Source
var (
	COMPRESSION_ENABLED_MIME_TYPES = []string{
		"text/html",
		"text/css",
		"text/plain",
		"text/xml",
		"text/x-component",
		"text/javascript",
		"application/x-javascript",
		"application/javascript",
		"application/json",
		"application/manifest+json",
		"application/vnd.api+json",
		"application/xml",
		"application/xhtml+xml",
		"application/rss+xml",
		"application/atom+xml",
		"application/vnd.ms-fontobject",
		"application/x-font-ttf",
		"application/x-font-opentype",
		"application/x-font-truetype",
		"image/svg+xml",
		"image/x-icon",
		"image/vnd.microsoft.icon",
		"font/ttf",
		"font/eot",
		"font/otf",
		"font/opentype",
	}
)

Functions

func AddVaryHeader

func AddVaryHeader(next http.Handler) http.Handler

func GenerateSelfSignedCertificate

func GenerateSelfSignedCertificate(certPath, keyPath string, validityDuration time.Duration) error

Types

type AdminBasicAuth

type AdminBasicAuth struct {
	*utils.Logger
	// contains filtered or unexported fields
}

AdminBasicAuth implements basic auth for the admin user account. Cache the success auth header to avoid the bcrypt hash check penalty Basic auth is supported for admin user only, and changing it requires service restart. Caching the sha of the successful auth header allows us to skip the bcrypt check which significantly improves performance.

func NewAdminBasicAuth

func NewAdminBasicAuth(logger *utils.Logger, config *utils.ServerConfig) *AdminBasicAuth

func (*AdminBasicAuth) BasicAuth

func (a *AdminBasicAuth) BasicAuth(authHeader string) (username, password string, ok bool)

type AppStore

type AppStore struct {
	*utils.Logger
	// contains filtered or unexported fields
}

AppStore is a store of apps. Apps are initialized lazily, the first GetApp call on each app will load the app from the database.

func NewAppStore

func NewAppStore(logger *utils.Logger, server *Server) *AppStore

func (*AppStore) AddApp

func (a *AppStore) AddApp(app *app.App)

func (*AppStore) DeleteApp

func (a *AppStore) DeleteApp(pathDomain utils.AppPathDomain) error

func (*AppStore) GetApp

func (a *AppStore) GetApp(pathDomain utils.AppPathDomain) (*app.App, error)

type Handler

type Handler struct {
	*utils.Logger
	// contains filtered or unexported fields
}

func NewTCPHandler

func NewTCPHandler(logger *utils.Logger, config *utils.ServerConfig, server *Server) *Handler

NewTCPHandler creates a new handler for HTTP/HTTPS requests. App API's are mounted amd authentication is enabled. It also mounts the internal APIs if admin over TCP is enabled

func NewUDSHandler

func NewUDSHandler(logger *utils.Logger, config *utils.ServerConfig, server *Server) *Handler

NewUDSHandler creates a new handler for admin APIs over the unix domain socket

type Server

type Server struct {
	*utils.Logger
	// contains filtered or unexported fields
}

Server is the instance of the Clace Server

func NewServer

func NewServer(config *utils.ServerConfig) (*Server, error)

NewServer creates a new instance of the Clace Server

func (*Server) AddApp

func (s *Server) AddApp(appEntry *utils.AppEntry, approve bool) (*utils.AuditResult, error)

func (*Server) AuditApp

func (s *Server) AuditApp(pathDomain utils.AppPathDomain, approve bool) (*utils.AuditResult, error)

func (*Server) DeleteApp

func (s *Server) DeleteApp(pathDomain utils.AppPathDomain) error

func (*Server) GetApp

func (s *Server) GetApp(pathDomain utils.AppPathDomain, init bool) (*app.App, error)

func (*Server) MatchApp

func (s *Server) MatchApp(hostHeader, matchPath string) (utils.AppPathDomain, error)

func (*Server) MatchAppForDomain

func (s *Server) MatchAppForDomain(domain, matchPath string) (string, error)

func (*Server) Start

func (s *Server) Start() error

Start starts the Clace Server

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

Stop stops the Clace Server

Jump to

Keyboard shortcuts

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