diff --git a/api/service.go b/api/service.go index f3ffe10ca..959128b15 100644 --- a/api/service.go +++ b/api/service.go @@ -19,7 +19,7 @@ func NewService(cfg config.APIService, server StrictServerInterface) *Service { SimpleHTTP: service.NewSimpleHTTP("API", endpoints), } - registerOpenAPIEndpoints(s.Mux, server) + registerOpenAPIEndpoints(s.Router(), server) return s } diff --git a/metrics/service.go b/metrics/service.go index c2d9d0849..4710c7121 100644 --- a/metrics/service.go +++ b/metrics/service.go @@ -25,7 +25,7 @@ func NewService(cfg config.MetricsService, metricsCfg config.Metrics) *Service { SimpleHTTP: service.NewSimpleHTTP("Metrics", endpoints), } - s.Mux.Handle( + s.Router().Handle( metricsCfg.Path, promhttp.InstrumentMetricHandler(reg, promhttp.HandlerFor(reg, promhttp.HandlerOpts{})), ) diff --git a/server/doh.go b/server/doh.go index 64354c610..9fd4e1b8b 100644 --- a/server/doh.go +++ b/server/doh.go @@ -30,7 +30,7 @@ func newDoHService(cfg config.DoHService, handler dnsHandler) *dohService { handler: handler, } - s.Mux.Route("/dns-query", func(mux chi.Router) { + s.Router().Route("/dns-query", func(mux chi.Router) { // Handlers for / also handle /dns-query without trailing slash mux.Get("/", s.handleGET) diff --git a/service/http.go b/service/http.go index 5ec5374c1..d963feaea 100644 --- a/service/http.go +++ b/service/http.go @@ -27,18 +27,18 @@ type HTTPService interface { type HTTPInfo struct { Info - Mux *chi.Mux + mux *chi.Mux } func NewHTTPInfo(name string, endpoints []Endpoint) HTTPInfo { return HTTPInfo{ Info: NewInfo(name, endpoints), - Mux: chi.NewMux(), + mux: chi.NewMux(), } } -func (i *HTTPInfo) Router() chi.Router { return i.Mux } +func (i *HTTPInfo) Router() chi.Router { return i.mux } var _ HTTPService = (*SimpleHTTP)(nil) diff --git a/service/service.go b/service/service.go index 5d60c2a5e..41d32c375 100644 --- a/service/service.go +++ b/service/service.go @@ -45,19 +45,19 @@ func svcString(s Service) string { // Info can be embedded in structs to help implement Service. type Info struct { - Name string - Endpoints []Endpoint + name string + endpoints []Endpoint } func NewInfo(name string, endpoints []Endpoint) Info { return Info{ - Name: name, - Endpoints: endpoints, + name: name, + endpoints: endpoints, } } -func (i *Info) ServiceName() string { return i.Name } -func (i *Info) ExposeOn() []Endpoint { return i.Endpoints } +func (i *Info) ServiceName() string { return i.name } +func (i *Info) ExposeOn() []Endpoint { return i.endpoints } func (i *Info) String() string { return svcString(i) } // GroupByListener returns a map of listener and services grouped by configured address.