diff --git a/http_server.go b/http_server.go index c1c832b..338727b 100644 --- a/http_server.go +++ b/http_server.go @@ -34,6 +34,13 @@ func (server *HealthServer) Address() string { return server.HealthAddress() } +// StartHealthServer is an explicit convenience wrapper around ServeHTTPHealth. +// +// health, err := service.StartHealthServer("127.0.0.1", 5554) +func (service *Service) StartHealthServer(bind string, port int) (*HealthServer, error) { + return service.ServeHTTPHealth(bind, port) +} + func (server *HealthServer) Close() error { if server == nil { return nil diff --git a/serve.go b/serve.go index 235be1f..3c3877a 100644 --- a/serve.go +++ b/serve.go @@ -270,6 +270,20 @@ func (service *Service) Serve(bind string, port int) (*DNSServer, error) { return dnsServer, nil } +// StartDNSServer is an explicit convenience wrapper around Serve. +// +// dnsServer, err := service.StartDNSServer("127.0.0.1", 53) +func (service *Service) StartDNSServer(bind string, port int) (*DNSServer, error) { + return service.Serve(bind, port) +} + +// StartDNSAndHealth is an explicit convenience wrapper around ServeAll. +// +// runtime, err := service.StartDNSAndHealth("127.0.0.1", 53, 5554) +func (service *Service) StartDNSAndHealth(bind string, dnsPort int, healthPort int) (*ServiceRuntime, error) { + return service.ServeAll(bind, dnsPort, healthPort) +} + // ServeAll starts DNS and health together. // // runtime, err := service.ServeAll("127.0.0.1", 53, 5554) @@ -318,6 +332,13 @@ func (service *Service) ServeConfigured(bind string) (*ServiceRuntime, error) { return service.ServeAll(bind, service.dnsPort, service.httpPort) } +// StartConfigured is an explicit convenience wrapper around ServeConfigured. +// +// runtime, err := service.StartConfigured("127.0.0.1") +func (service *Service) StartConfigured(bind string) (*ServiceRuntime, error) { + return service.ServeConfigured(bind) +} + type dnsRequestHandler struct { service *Service }