Documentation ¶
Index ¶
- Constants
- Variables
- func AddVaryHeader(next http.Handler) http.Handler
- func GenerateSelfSignedCertificate(certPath, keyPath string, validityDuration time.Duration) error
- type AdminBasicAuth
- type AppStore
- type Handler
- type Server
- func (s *Server) AddApp(appEntry *utils.AppEntry, approve bool) (*utils.AuditResult, error)
- func (s *Server) AuditApp(pathDomain utils.AppPathDomain, approve bool) (*utils.AuditResult, error)
- func (s *Server) DeleteApp(pathDomain utils.AppPathDomain) error
- func (s *Server) GetApp(pathDomain utils.AppPathDomain, init bool) (*app.App, error)
- func (s *Server) MatchApp(hostHeader, matchPath string) (utils.AppPathDomain, error)
- func (s *Server) MatchAppForDomain(domain, matchPath string) (string, error)
- func (s *Server) Start() error
- func (s *Server) Stop(ctx context.Context) error
Constants ¶
const ( DEFAULT_CERT_FILE = "default.crt" DEFAULT_KEY_FILE = "default.key" )
const (
REALM = "clace"
)
const (
VARY_HEADER = "Vary"
)
Variables ¶
var CL_HOME = os.ExpandEnv("$CL_HOME")
CL_HOME is the root directory for Clace logs and temp files
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 ¶
Types ¶
type AdminBasicAuth ¶
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
type AppStore ¶
AppStore is a store of apps. Apps are initialized lazily, the first GetApp call on each app will load the app from the database.
type Handler ¶
func NewTCPHandler ¶
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 ¶
NewUDSHandler creates a new handler for admin APIs over the unix domain socket
type Server ¶
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) AuditApp ¶
func (s *Server) AuditApp(pathDomain utils.AppPathDomain, approve bool) (*utils.AuditResult, error)
func (*Server) MatchApp ¶
func (s *Server) MatchApp(hostHeader, matchPath string) (utils.AppPathDomain, error)