1
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-16 21:56:40 -05:00

r/RegisterType/RegisterNamespace/g

Co-Author: Matt Holt
This commit is contained in:
Mohammed Al Sahaf 2023-12-14 23:50:24 +03:00
parent 52441e3037
commit 18b346f6f9
No known key found for this signature in database
15 changed files with 23 additions and 23 deletions

View file

@ -55,7 +55,7 @@ func init() {
if env, exists := os.LookupEnv("CADDY_ADMIN"); exists { if env, exists := os.LookupEnv("CADDY_ADMIN"); exists {
DefaultAdminListen = env 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 // AdminConfig configures Caddy's API endpoint, which is used

View file

@ -42,10 +42,10 @@ import (
) )
func init() { func init() {
RegisterType("", []interface{}{ RegisterNamespace("", []interface{}{
(*App)(nil), (*App)(nil),
}) })
RegisterType("caddy.storage", []interface{}{ RegisterNamespace("caddy.storage", []interface{}{
(*StorageConverter)(nil), (*StorageConverter)(nil),
}) })
} }

View file

@ -38,7 +38,7 @@ import (
) )
func init() { func init() {
RegisterType("caddy.listeners", []interface{}{ RegisterNamespace("caddy.listeners", []interface{}{
(*ListenerWrapper)(nil), (*ListenerWrapper)(nil),
}) })
} }

View file

@ -33,10 +33,10 @@ func init() {
RegisterModule(StdoutWriter{}) RegisterModule(StdoutWriter{})
RegisterModule(StderrWriter{}) RegisterModule(StderrWriter{})
RegisterModule(DiscardWriter{}) RegisterModule(DiscardWriter{})
RegisterType("caddy.logging.encoders", []interface{}{ RegisterNamespace("caddy.logging.encoders", []interface{}{
(*zapcore.Encoder)(nil), (*zapcore.Encoder)(nil),
}) })
RegisterType("caddy.logging.writers", []interface{}{ RegisterNamespace("caddy.logging.writers", []interface{}{
(*WriterOpener)(nil), (*WriterOpener)(nil),
}) })
} }

View file

@ -32,10 +32,10 @@ import (
func init() { func init() {
caddy.RegisterModule(HTTPBasicAuth{}) caddy.RegisterModule(HTTPBasicAuth{})
caddy.RegisterType("http.authentication.hashes", []interface{}{ caddy.RegisterNamespace("http.authentication.hashes", []interface{}{
(*Comparer)(nil), (*Comparer)(nil),
}) })
caddy.RegisterType("http.authentication.providers", []interface{}{ caddy.RegisterNamespace("http.authentication.providers", []interface{}{
(*Authenticator)(nil), (*Authenticator)(nil),
}) })
} }

View file

@ -37,7 +37,7 @@ import (
func init() { func init() {
caddy.RegisterModule(Encode{}) caddy.RegisterModule(Encode{})
caddy.RegisterType("http.encoders", []interface{}{ caddy.RegisterNamespace("http.encoders", []interface{}{
(*Encoding)(nil), (*Encoding)(nil),
}) })
} }

View file

@ -38,7 +38,7 @@ import (
) )
func init() { func init() {
caddy.RegisterType("http.precompressed", []interface{}{ caddy.RegisterNamespace("http.precompressed", []interface{}{
(*encode.Precompressed)(nil), (*encode.Precompressed)(nil),
}) })

View file

@ -214,7 +214,7 @@ func init() {
caddy.RegisterModule(MatchHeaderRE{}) caddy.RegisterModule(MatchHeaderRE{})
caddy.RegisterModule(new(MatchProtocol)) caddy.RegisterModule(new(MatchProtocol))
caddy.RegisterModule(MatchNot{}) caddy.RegisterModule(MatchNot{})
caddy.RegisterType("http.matchers", []interface{}{ caddy.RegisterNamespace("http.matchers", []interface{}{
(*RequestMatcher)(nil), (*RequestMatcher)(nil),
}) })
} }

View file

@ -46,16 +46,16 @@ import (
func init() { func init() {
caddy.RegisterModule(Handler{}) caddy.RegisterModule(Handler{})
caddy.RegisterType("http.reverse_proxy.circuit_breakers", []interface{}{ caddy.RegisterNamespace("http.reverse_proxy.circuit_breakers", []interface{}{
(*CircuitBreaker)(nil), (*CircuitBreaker)(nil),
}) })
caddy.RegisterType("http.reverse_proxy.selection_policies", []interface{}{ caddy.RegisterNamespace("http.reverse_proxy.selection_policies", []interface{}{
(*Selector)(nil), (*Selector)(nil),
}) })
caddy.RegisterType("http.reverse_proxy.transport", []interface{}{ caddy.RegisterNamespace("http.reverse_proxy.transport", []interface{}{
(*http.RoundTripper)(nil), (*http.RoundTripper)(nil),
}) })
caddy.RegisterType("http.reverse_proxy.upstreams", []interface{}{ caddy.RegisterNamespace("http.reverse_proxy.upstreams", []interface{}{
(*UpstreamSource)(nil), (*UpstreamSource)(nil),
}) })
} }

View file

@ -23,7 +23,7 @@ import (
) )
func init() { func init() {
caddy.RegisterType("http.handlers", []interface{}{ caddy.RegisterNamespace("http.handlers", []interface{}{
(*MiddlewareHandler)(nil), (*MiddlewareHandler)(nil),
}) })
} }

View file

@ -31,13 +31,13 @@ import (
) )
func init() { func init() {
caddy.RegisterType("dns.provider", []interface{}{ caddy.RegisterNamespace("dns.provider", []interface{}{
(*acmez.Solver)(nil), (*acmez.Solver)(nil),
}) })
caddy.RegisterType("tls.get_certificate", []interface{}{ caddy.RegisterNamespace("tls.get_certificate", []interface{}{
(*certmagic.Manager)(nil), (*certmagic.Manager)(nil),
}) })
caddy.RegisterType("tls.issuance", []interface{}{ caddy.RegisterNamespace("tls.issuance", []interface{}{
(*certmagic.Issuer)(nil), (*certmagic.Issuer)(nil),
}) })
} }

View file

@ -33,7 +33,7 @@ import (
func init() { func init() {
caddy.RegisterModule(LeafCertClientAuth{}) caddy.RegisterModule(LeafCertClientAuth{})
caddy.RegisterType("tls.handshake_match", []interface{}{ caddy.RegisterNamespace("tls.handshake_match", []interface{}{
(*ConnectionMatcher)(nil), (*ConnectionMatcher)(nil),
}) })
} }

View file

@ -29,7 +29,7 @@ import (
) )
func init() { func init() {
caddy.RegisterType("tls.stek", []interface{}{ caddy.RegisterNamespace("tls.stek", []interface{}{
(*STEKProvider)(nil), (*STEKProvider)(nil),
}) })
} }

View file

@ -36,7 +36,7 @@ func init() {
caddy.RegisterModule(TLS{}) caddy.RegisterModule(TLS{})
caddy.RegisterModule(AutomateLoader{}) caddy.RegisterModule(AutomateLoader{})
caddy.RegisterType("tls.certificates", []interface{}{ caddy.RegisterNamespace("tls.certificates", []interface{}{
(*CertificateLoader)(nil), (*CertificateLoader)(nil),
}) })
} }

View file

@ -7,7 +7,7 @@ import (
var namespaceTypes map[string][]reflect.Type = make(map[string][]reflect.Type) 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 var types []reflect.Type
for _, v := range vals { for _, v := range vals {
reflect.TypeOf(v).Elem() reflect.TypeOf(v).Elem()