Documentation
¶
Overview ¶
Package websvc contains the AdGuard Home web service.
TODO(a.garipov): Add tests.
Index ¶
Constants ¶
const ( PathHealthCheck = "/health-check" PathV1SystemInfo = "/api/v1/system/info" )
Path constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// TLS is the optional TLS configuration. If TLS is not nil,
// SecureAddresses must not be empty.
TLS *tls.Config
// Addresses are the addresses on which to serve the plain HTTP API.
Addresses []netip.AddrPort
// SecureAddresses are the addresses on which to serve the HTTPS API. If
// SecureAddresses is not empty, TLS must not be nil.
SecureAddresses []netip.AddrPort
// Start is the time of start of AdGuard Home.
Start time.Time
// Timeout is the timeout for all server operations.
Timeout time.Duration
}
Config is the AdGuard Home web service configuration structure.
type RespGetV1SystemInfo ¶
type RespGetV1SystemInfo struct {
Arch string `json:"arch"`
Channel string `json:"channel"`
OS string `json:"os"`
NewVersion string `json:"new_version,omitempty"`
Start jsonTime `json:"start"`
Version string `json:"version"`
}
RespGetV1SystemInfo describes the response of the GET /api/v1/system/info HTTP API.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the AdGuard Home web service. A nil *Service is a valid agh.Service that does nothing.
func New ¶
New returns a new properly initialized *Service. If c is nil, svc is a nil *Service that does nothing.
func (*Service) Addrs ¶
Addrs returns all addresses on which this server serves the HTTP API. Addrs must not be called until Start returns.
func (*Service) Shutdown ¶
Shutdown implements the agh.Service interface for *Service. svc may be nil.
func (*Service) Start ¶
Start implements the agh.Service interface for *Service. svc may be nil. After Start exits, all HTTP servers have tried to start, possibly failing and writing error messages to the log.