diff --git a/admin.go b/admin.go index b0d12992e..30dc6da8e 100644 --- a/admin.go +++ b/admin.go @@ -55,7 +55,7 @@ func init() { if env, exists := os.LookupEnv("CADDY_ADMIN"); exists { DefaultAdminListen = env } - RegisterType("caddy.config_loaders", []interface{}{(*ConfigLoader)(nil)}) + RegisterNamespace("caddy.config_loaders", []interface{}{(*ConfigLoader)(nil)}) } // AdminConfig configures Caddy's API endpoint, which is used diff --git a/caddy.go b/caddy.go index 3b8f2851a..685f9c1d1 100644 --- a/caddy.go +++ b/caddy.go @@ -42,10 +42,10 @@ import ( ) func init() { - RegisterType("", []interface{}{ + RegisterNamespace("", []interface{}{ (*App)(nil), }) - RegisterType("caddy.storage", []interface{}{ + RegisterNamespace("caddy.storage", []interface{}{ (*StorageConverter)(nil), }) } diff --git a/listeners.go b/listeners.go index 34e1fc16a..805d7b60c 100644 --- a/listeners.go +++ b/listeners.go @@ -38,7 +38,7 @@ import ( ) func init() { - RegisterType("caddy.listeners", []interface{}{ + RegisterNamespace("caddy.listeners", []interface{}{ (*ListenerWrapper)(nil), }) } diff --git a/logging.go b/logging.go index 22caa1fe3..6ad2e9121 100644 --- a/logging.go +++ b/logging.go @@ -33,10 +33,10 @@ func init() { RegisterModule(StdoutWriter{}) RegisterModule(StderrWriter{}) RegisterModule(DiscardWriter{}) - RegisterType("caddy.logging.encoders", []interface{}{ + RegisterNamespace("caddy.logging.encoders", []interface{}{ (*zapcore.Encoder)(nil), }) - RegisterType("caddy.logging.writers", []interface{}{ + RegisterNamespace("caddy.logging.writers", []interface{}{ (*WriterOpener)(nil), }) } diff --git a/modules/caddyhttp/caddyauth/basicauth.go b/modules/caddyhttp/caddyauth/basicauth.go index 9e4832738..f69780998 100644 --- a/modules/caddyhttp/caddyauth/basicauth.go +++ b/modules/caddyhttp/caddyauth/basicauth.go @@ -32,10 +32,10 @@ import ( func init() { caddy.RegisterModule(HTTPBasicAuth{}) - caddy.RegisterType("http.authentication.hashes", []interface{}{ + caddy.RegisterNamespace("http.authentication.hashes", []interface{}{ (*Comparer)(nil), }) - caddy.RegisterType("http.authentication.providers", []interface{}{ + caddy.RegisterNamespace("http.authentication.providers", []interface{}{ (*Authenticator)(nil), }) } diff --git a/modules/caddyhttp/encode/encode.go b/modules/caddyhttp/encode/encode.go index 6787e60ab..f905502a3 100644 --- a/modules/caddyhttp/encode/encode.go +++ b/modules/caddyhttp/encode/encode.go @@ -37,7 +37,7 @@ import ( func init() { caddy.RegisterModule(Encode{}) - caddy.RegisterType("http.encoders", []interface{}{ + caddy.RegisterNamespace("http.encoders", []interface{}{ (*Encoding)(nil), }) } diff --git a/modules/caddyhttp/fileserver/staticfiles.go b/modules/caddyhttp/fileserver/staticfiles.go index f419f7c70..59c8d68c9 100644 --- a/modules/caddyhttp/fileserver/staticfiles.go +++ b/modules/caddyhttp/fileserver/staticfiles.go @@ -38,7 +38,7 @@ import ( ) func init() { - caddy.RegisterType("http.precompressed", []interface{}{ + caddy.RegisterNamespace("http.precompressed", []interface{}{ (*encode.Precompressed)(nil), }) diff --git a/modules/caddyhttp/matchers.go b/modules/caddyhttp/matchers.go index 9a28f6805..5ebec0435 100644 --- a/modules/caddyhttp/matchers.go +++ b/modules/caddyhttp/matchers.go @@ -214,7 +214,7 @@ func init() { caddy.RegisterModule(MatchHeaderRE{}) caddy.RegisterModule(new(MatchProtocol)) caddy.RegisterModule(MatchNot{}) - caddy.RegisterType("http.matchers", []interface{}{ + caddy.RegisterNamespace("http.matchers", []interface{}{ (*RequestMatcher)(nil), }) } diff --git a/modules/caddyhttp/reverseproxy/reverseproxy.go b/modules/caddyhttp/reverseproxy/reverseproxy.go index 973f47130..09604f1d6 100644 --- a/modules/caddyhttp/reverseproxy/reverseproxy.go +++ b/modules/caddyhttp/reverseproxy/reverseproxy.go @@ -46,16 +46,16 @@ import ( func init() { caddy.RegisterModule(Handler{}) - caddy.RegisterType("http.reverse_proxy.circuit_breakers", []interface{}{ + caddy.RegisterNamespace("http.reverse_proxy.circuit_breakers", []interface{}{ (*CircuitBreaker)(nil), }) - caddy.RegisterType("http.reverse_proxy.selection_policies", []interface{}{ + caddy.RegisterNamespace("http.reverse_proxy.selection_policies", []interface{}{ (*Selector)(nil), }) - caddy.RegisterType("http.reverse_proxy.transport", []interface{}{ + caddy.RegisterNamespace("http.reverse_proxy.transport", []interface{}{ (*http.RoundTripper)(nil), }) - caddy.RegisterType("http.reverse_proxy.upstreams", []interface{}{ + caddy.RegisterNamespace("http.reverse_proxy.upstreams", []interface{}{ (*UpstreamSource)(nil), }) } diff --git a/modules/caddyhttp/routes.go b/modules/caddyhttp/routes.go index e89c4700c..13bd5ad52 100644 --- a/modules/caddyhttp/routes.go +++ b/modules/caddyhttp/routes.go @@ -23,7 +23,7 @@ import ( ) func init() { - caddy.RegisterType("http.handlers", []interface{}{ + caddy.RegisterNamespace("http.handlers", []interface{}{ (*MiddlewareHandler)(nil), }) } diff --git a/modules/caddytls/automation.go b/modules/caddytls/automation.go index a537b6db5..576fc943b 100644 --- a/modules/caddytls/automation.go +++ b/modules/caddytls/automation.go @@ -31,13 +31,13 @@ import ( ) func init() { - caddy.RegisterType("dns.provider", []interface{}{ + caddy.RegisterNamespace("dns.provider", []interface{}{ (*acmez.Solver)(nil), }) - caddy.RegisterType("tls.get_certificate", []interface{}{ + caddy.RegisterNamespace("tls.get_certificate", []interface{}{ (*certmagic.Manager)(nil), }) - caddy.RegisterType("tls.issuance", []interface{}{ + caddy.RegisterNamespace("tls.issuance", []interface{}{ (*certmagic.Issuer)(nil), }) } diff --git a/modules/caddytls/connpolicy.go b/modules/caddytls/connpolicy.go index 1ab98a3e9..bbadaa583 100644 --- a/modules/caddytls/connpolicy.go +++ b/modules/caddytls/connpolicy.go @@ -33,7 +33,7 @@ import ( func init() { caddy.RegisterModule(LeafCertClientAuth{}) - caddy.RegisterType("tls.handshake_match", []interface{}{ + caddy.RegisterNamespace("tls.handshake_match", []interface{}{ (*ConnectionMatcher)(nil), }) } diff --git a/modules/caddytls/sessiontickets.go b/modules/caddytls/sessiontickets.go index 8456a80f3..7a6194241 100644 --- a/modules/caddytls/sessiontickets.go +++ b/modules/caddytls/sessiontickets.go @@ -29,7 +29,7 @@ import ( ) func init() { - caddy.RegisterType("tls.stek", []interface{}{ + caddy.RegisterNamespace("tls.stek", []interface{}{ (*STEKProvider)(nil), }) } diff --git a/modules/caddytls/tls.go b/modules/caddytls/tls.go index 6606ef554..2324c4471 100644 --- a/modules/caddytls/tls.go +++ b/modules/caddytls/tls.go @@ -36,7 +36,7 @@ func init() { caddy.RegisterModule(TLS{}) caddy.RegisterModule(AutomateLoader{}) - caddy.RegisterType("tls.certificates", []interface{}{ + caddy.RegisterNamespace("tls.certificates", []interface{}{ (*CertificateLoader)(nil), }) } diff --git a/types.go b/types.go index 6d4f68245..db5d8e8c8 100644 --- a/types.go +++ b/types.go @@ -7,7 +7,7 @@ import ( var namespaceTypes map[string][]reflect.Type = make(map[string][]reflect.Type) -func RegisterType(namespace string, vals []interface{}) { +func RegisterNamespace(namespace string, vals []interface{}) { var types []reflect.Type for _, v := range vals { reflect.TypeOf(v).Elem()