Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dispatcher ¶
type Dispatcher map[model.TransportType]Service
Dispatcher dispatches router health probes to underlying Services based on TransportType.
func NewHTTPDispatcher ¶
func NewHTTPDispatcher(uri, uri3 string) (m Dispatcher, e error)
NewHTTPDispatcher creates a Dispatcher of HTTPClients from base URI.
uri: base URI for UDP and WebSockets probe. uri3: base URI for HTTP/3 probe.
func (Dispatcher) Probe ¶
func (m Dispatcher) Probe(ctx context.Context, req ProbeRequest) (res ProbeResponse, e error)
Probe implements Service interface.
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient implements a Service that probes router health via a backend HTTP service.
func NewHTTPClient ¶
func NewHTTPClient(uri string) (c *HTTPClient, e error)
NewHTTPClient creates a Client from base URI.
func (*HTTPClient) Probe ¶
func (c *HTTPClient) Probe(ctx context.Context, req ProbeRequest) (res ProbeResponse, e error)
Probe implements Service interface.
type ProbeNameResult ¶
type ProbeNameResult struct { OK bool `json:"ok"` RTT float64 `json:"rtt,omitempty"` // milliseconds Error string `json:"error,omitempty"` }
ProbeNameResult contains per-name probe result.
type ProbeRequest ¶
type ProbeRequest struct { model.TransportIPFamily Router string `json:"router"` Names []string `json:"names"` }
ProbeRequest contains a request for health monitoring probe.
type ProbeResponse ¶
type ProbeResponse struct { Connected bool `json:"connected"` ConnectError string `json:"connectError,omitempty"` Probes []ProbeNameResult `json:"probes,omitempty"` }
ProbeResponse contains router probe result.
func (ProbeResponse) Count ¶
func (response ProbeResponse) Count() (nSuccess, nFailure int)
Count returns number of probes with OK==true and OK==false.
type Service ¶
type Service interface {
Probe(ctx context.Context, req ProbeRequest) (res ProbeResponse, e error)
}
Service represents a service that can probe router health.