debugsvc

package
v0.0.0-...-f179113 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2024 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Overview

Package debugsvc contains the debug HTTP API of AdGuard DNS.

Index

Constants

View Source
const (
	PathPatternDNSDBCSV        = "/dnsdb/csv"
	PathPatternDebugAPICache   = "/debug/api/cache/clear"
	PathPatternDebugAPIRefresh = "/debug/api/refresh"
	PathPatternHealthCheck     = "/health-check"
	PathPatternMetrics         = "/metrics"
)

Path pattern constants.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DNSDBHandler   http.Handler
	Logger         *slog.Logger
	Manager        *agdcache.DefaultManager
	Refreshers     Refreshers
	DNSDBAddr      string
	APIAddr        string
	PprofAddr      string
	PrometheusAddr string
}

Config is the AdGuard DNS HTTP service configuration structure.

type RefresherID

type RefresherID = string

RefresherID is a type alias for strings that represent IDs of refreshers.

TODO(a.garipov): Consider a newtype with validations.

type Refreshers

type Refreshers map[RefresherID]agdservice.Refresher

Refreshers is a type alias for maps of refresher IDs to Refreshers themselves.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is the HTTP service of AdGuard DNS. It serves prometheus metrics, pprof, health check, DNSDB, and other endpoints.

func New

func New(c *Config) (svc *Service)

New returns a new properly initialized *Service.

func (*Service) Shutdown

func (svc *Service) Shutdown(ctx context.Context) (err error)

Shutdown implements the service.Interface interface for *Service. It stops serving all endpoints.

func (*Service) Start

func (svc *Service) Start(ctx context.Context) (err error)

Start implements the service.Interface interface for *Service. It starts serving all endpoints but does not wait for them to actually go online. err is always nil, if any endpoint fails to start, it panics.

TODO(a.garipov): Wait for the services to go online.

TODO(a.garipov): Use the context for cancelation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL