web

package
v1.9.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ClientHandler = NewBroadcastManager()
)

Functions

func IPWhitelist added in v1.4.0

func IPWhitelist(whitelist []string) func(next http.Handler) http.Handler

IPWhitelist returns a middleware that checks if the IP of the client is in the whitelist.

func SetExampleCert

func SetExampleCert(cert models.Entry)

SetExampleCert sets one certificate as the example Cert that is returned by the example endpoints.

Types

type BroadcastManager

type BroadcastManager struct {
	Broadcast chan models.Entry
	// contains filtered or unexported fields
}

func NewBroadcastManager

func NewBroadcastManager() *BroadcastManager

func (*BroadcastManager) ClientDomainsCount

func (bm *BroadcastManager) ClientDomainsCount() (count int64)

ClientDomainsCount returns the current number of clients connected to the service on the `domains-only` endpoint.

func (*BroadcastManager) ClientFullCount

func (bm *BroadcastManager) ClientFullCount() (count int64)

ClientFullCount returns the current number of clients connected to the service on the `full` endpoint.

func (*BroadcastManager) ClientLiteCount

func (bm *BroadcastManager) ClientLiteCount() (count int64)

ClientLiteCount returns the current number of clients connected to the service on the `lite` endpoint.

func (*BroadcastManager) GetSkippedCerts added in v1.6.0

func (bm *BroadcastManager) GetSkippedCerts() map[string]uint64

type SubscriptionType

type SubscriptionType int
const (
	SubTypeFull SubscriptionType = iota
	SubTypeLite
	SubTypeDomain
)

type WebServer

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

WebServer is a struct that holds the necessary information to run a webserver. It is used for the websocket server as well as the metrics server.

func NewMetricsServer

func NewMetricsServer(networkIf string, port int, certPath, keyPath string) *WebServer

NewMetricsServer creates a new webserver that listens on the given port and provides metrics for a metrics server.

func NewWebsocketServer

func NewWebsocketServer(networkIf string, port int, certPath, keyPath string) *WebServer

NewWebsocketServer starts a new webserver and initialized it with the necessary routes. It also starts the broadcaster in ClientHandler as a background job and takes care of setting up websocket.Upgrader.

func (*WebServer) RegisterPrometheus

func (ws *WebServer) RegisterPrometheus(url string, callback func(w io.Writer, exposeProcessMetrics bool))

RegisterPrometheus registers a new handler that listens on the given url and calls the given function in order to provide metrics for a prometheus server. This function signature was used, because VictoriaMetrics offers exactly this function signature.

func (*WebServer) Start

func (ws *WebServer) Start()

Start initializes the webserver and starts listening for connections.

func (*WebServer) Stop added in v1.8.0

func (ws *WebServer) Stop()

Stop tries to stop the webserver gracefully. If it doesn't stop within 15 seconds, it is forcefully closed.

Jump to

Keyboard shortcuts

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