server

package
v0.0.0-...-55c65bb Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Overview

Package server provides the implementation of the HTTP server components used by the gateway.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertSpan

func AssertSpan(t *testing.T, span *tracetest.SpanStub, name string, attributes map[string]any)

func GetTracer

func GetTracer() (trace.Tracer, *tracetest.InMemoryExporter)

func NewBroker

func NewBroker(t *testing.T) (*mqtt.Server, *url.URL)

func NewStatusHandler

func NewStatusHandler() http.Handler

func NewWebsocketHandler

func NewWebsocketHandler(opts ...WebsocketOpt) http.Handler

func TLSOffload

func TLSOffload(registry registry.DeviceRegistry) func(http.Handler) http.Handler

func TraceRequest

func TraceRequest(tracer trace.Tracer) func(http.Handler) http.Handler

Types

type Server

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

func New

func New(name, addr string, tlsConfig *tls.Config, handler http.Handler) *Server

func (*Server) Addr

func (s *Server) Addr() string

func (*Server) Start

func (s *Server) Start(errCh chan error)

func (*Server) Stop

func (s *Server) Stop(ctx context.Context) error

type WebsocketHandler

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

func (*WebsocketHandler) ServeHTTP

func (s *WebsocketHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type WebsocketOpt

type WebsocketOpt func(handler *WebsocketHandler)

func WithDeviceRegistry

func WithDeviceRegistry(deviceRegistry registry.DeviceRegistry) WebsocketOpt

func WithMqttBrokerUrl

func WithMqttBrokerUrl(brokerUrl *url.URL) WebsocketOpt

func WithMqttBrokerUrlString

func WithMqttBrokerUrlString(brokerUrl string) WebsocketOpt

func WithMqttBrokerUrls

func WithMqttBrokerUrls(brokerUrls []*url.URL) WebsocketOpt

func WithMqttConnectSettings

func WithMqttConnectSettings(mqttConnectTimeout, mqttConnectRetryDelay, mqttKeepAliveInterval time.Duration) WebsocketOpt

func WithMqttTopicPrefix

func WithMqttTopicPrefix(topicPrefix string) WebsocketOpt

func WithOrgName

func WithOrgName(orgName string) WebsocketOpt

func WithOrgNames

func WithOrgNames(orgNames []string) WebsocketOpt

func WithOtelTracer

func WithOtelTracer(tracer trace.Tracer) WebsocketOpt

func WithPipeOption

func WithPipeOption(pipeOption pipe.Opt) WebsocketOpt

func WithPipeOptions

func WithPipeOptions(pipeOption []pipe.Opt) WebsocketOpt

func WithTrustProxyHeaders

func WithTrustProxyHeaders(trustProxyHeaders bool) WebsocketOpt

Jump to

Keyboard shortcuts

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