Versions in this module Expand all Collapse all v2 v2.6.5 Jun 21, 2023 Changes in this version + const DefaultLoggerName + const ExitCodeFailedQuit + const ExitCodeFailedStartup + const ExitCodeForceQuit + const ExitCodeSuccess + const ImportPath + var ConfigAutosavePath = filepath.Join(AppConfigDir(), "autosave.json") + var CustomVersion string + var DefaultAdminListen = "localhost:2019" + var DefaultRemoteAdminListen = ":2021" + var DefaultStorage = &certmagic.FileStorage + func AppConfigDir() string + func AppDataDir() string + func Exiting() bool + func GetModuleID(instance any) string + func GetModuleName(instance any) string + func HomeDir() string + func InstanceID() (uuid.UUID, error) + func IsUnixNetwork(netw string) bool + func JoinNetworkAddress(network, host, port string) string + func Listen(network, addr string) (net.Listener, error) + func ListenPacket(network, addr string) (net.PacketConn, error) + func ListenQUIC(ln net.PacketConn, tlsConf *tls.Config, activeRequests *int64) (http3.QUICEarlyListener, error) + func ListenTimeout(network, addr string, keepalivePeriod time.Duration) (net.Listener, error) + func ListenerUsage(network, addr string) int + func Load(cfgJSON []byte, forceReload bool) error + func Log() *zap.Logger + func Modules() []string + func PIDFile(filename string) error + func ParseDuration(s string) (time.Duration, error) + func ParseStructTag(tag string) (map[string]string, error) + func RegisterModule(instance Module) + func RegisterNetwork(network string, getListener ListenerFunc) + func RemoveMetaFields(rawJSON []byte) []byte + func Run(cfg *Config) error + func SplitNetworkAddress(a string) (network, host, port string, err error) + func Stop() error + func StrictUnmarshalJSON(data []byte, v any) error + func ToString(val any) string + func TrapSignals() + func Validate(cfg *Config) error + func Version() (simple, full string) + type APIError struct + Err error + HTTPStatus int + Message string + func (e APIError) Error() string + type AdminAccess struct + Permissions []AdminPermissions + PublicKeys []string + type AdminConfig struct + Config *ConfigSettings + Disabled bool + EnforceOrigin bool + Identity *IdentityConfig + Listen string + Origins []string + Remote *RemoteAdmin + type AdminHandler interface + ServeHTTP func(http.ResponseWriter, *http.Request) error + type AdminHandlerFunc func(http.ResponseWriter, *http.Request) error + func (f AdminHandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request) error + type AdminPermissions struct + Methods []string + Paths []string + type AdminRoute struct + Handler AdminHandler + Pattern string + type AdminRouter interface + Routes func() []AdminRoute + type App interface + Start func() error + Stop func() error + type BaseLog struct + EncoderRaw json.RawMessage + Level string + Sampling *LogSampling + WriterRaw json.RawMessage + type CleanerUpper interface + Cleanup func() error + type Config struct + Admin *AdminConfig + AppsRaw ModuleMap + Logging *Logging + StorageRaw json.RawMessage + type ConfigLoader interface + LoadConfig func(Context) ([]byte, error) + type ConfigSettings struct + LoadDelay Duration + LoadRaw json.RawMessage + Persist *bool + type Constructor func() (Destructor, error) + type Context struct + func ActiveContext() Context + func NewContext(ctx Context) (Context, context.CancelFunc) + func (ctx *Context) OnCancel(f func()) + func (ctx Context) App(name string) (any, error) + func (ctx Context) AppIfConfigured(name string) (any, error) + func (ctx Context) IdentityCredentials(logger *zap.Logger) ([]tls.Certificate, error) + func (ctx Context) LoadModule(structPointer any, fieldName string) (any, error) + func (ctx Context) LoadModuleByID(id string, rawMsg json.RawMessage) (any, error) + func (ctx Context) Logger(module ...Module) *zap.Logger + func (ctx Context) Module() Module + func (ctx Context) Modules() []Module + func (ctx Context) Storage() certmagic.Storage + type CtxKey string + const ReplacerCtxKey + type CustomLog struct + Exclude []string + Include []string + type Destructor interface + Destruct func() error + type DiscardWriter struct + func (DiscardWriter) CaddyModule() ModuleInfo + func (DiscardWriter) OpenWriter() (io.WriteCloser, error) + func (DiscardWriter) String() string + func (DiscardWriter) WriterKey() string + type Duration time.Duration + func (d *Duration) UnmarshalJSON(b []byte) error + type IdentityConfig struct + Identifiers []string + IssuersRaw []json.RawMessage + type ListenerFunc func(ctx context.Context, network, addr string, cfg net.ListenConfig) (any, error) + type ListenerWrapper interface + WrapListener func(net.Listener) net.Listener + type LogSampling struct + First int + Interval time.Duration + Thereafter int + type Logging struct + Logs map[string]*CustomLog + Sink *SinkLog + func (logging *Logging) Logger(mod Module) *zap.Logger + type Module interface + CaddyModule func() ModuleInfo + type ModuleID string + func (id ModuleID) Name() string + func (id ModuleID) Namespace() string + type ModuleInfo struct + ID ModuleID + New func() Module + func GetModule(name string) (ModuleInfo, error) + func GetModules(scope string) []ModuleInfo + func (mi ModuleInfo) String() string + type ModuleMap map[string]json.RawMessage + type NetworkAddress struct + EndPort uint + Host string + Network string + StartPort uint + func ParseNetworkAddress(addr string) (NetworkAddress, error) + func ParseNetworkAddressWithDefaults(addr, defaultNetwork string, defaultPort uint) (NetworkAddress, error) + func (na NetworkAddress) At(portOffset uint) NetworkAddress + func (na NetworkAddress) Expand() []NetworkAddress + func (na NetworkAddress) IsUnixNetwork() bool + func (na NetworkAddress) JoinHostPort(offset uint) string + func (na NetworkAddress) Listen(ctx context.Context, portOffset uint, config net.ListenConfig) (any, error) + func (na NetworkAddress) ListenAll(ctx context.Context, config net.ListenConfig) ([]any, error) + func (na NetworkAddress) PortRangeSize() uint + func (na NetworkAddress) String() string + type Provisioner interface + Provision func(Context) error + type RemoteAdmin struct + AccessControl []*AdminAccess + Listen string + type ReplacementFunc func(variable string, val any) (any, error) + type Replacer struct + func NewEmptyReplacer() *Replacer + func NewReplacer() *Replacer + func (r *Replacer) Delete(variable string) + func (r *Replacer) Get(variable string) (any, bool) + func (r *Replacer) GetString(variable string) (string, bool) + func (r *Replacer) Map(mapFunc ReplacerFunc) + func (r *Replacer) ReplaceAll(input, empty string) string + func (r *Replacer) ReplaceFunc(input string, f ReplacementFunc) (string, error) + func (r *Replacer) ReplaceKnown(input, empty string) string + func (r *Replacer) ReplaceOrErr(input string, errOnEmpty, errOnUnknown bool) (string, error) + func (r *Replacer) Set(variable string, value any) + type ReplacerFunc func(key string) (any, bool) + type SinkLog struct + type StderrWriter struct + func (StderrWriter) CaddyModule() ModuleInfo + func (StderrWriter) OpenWriter() (io.WriteCloser, error) + func (StderrWriter) String() string + func (StderrWriter) WriterKey() string + type StdoutWriter struct + func (StdoutWriter) CaddyModule() ModuleInfo + func (StdoutWriter) OpenWriter() (io.WriteCloser, error) + func (StdoutWriter) String() string + func (StdoutWriter) WriterKey() string + type StorageConverter interface + CertMagicStorage func() (certmagic.Storage, error) + type UsagePool struct + func NewUsagePool() *UsagePool + func (up *UsagePool) Delete(key any) (deleted bool, err error) + func (up *UsagePool) LoadOrNew(key any, construct Constructor) (value any, loaded bool, err error) + func (up *UsagePool) LoadOrStore(key, val any) (value any, loaded bool) + func (up *UsagePool) Range(f func(key, value any) bool) + func (up *UsagePool) References(key any) (int, bool) + type Validator interface + Validate func() error + type WriterOpener interface + OpenWriter func() (io.WriteCloser, error) + WriterKey func() string