web

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ClientHandler = BroadcastManager{}
)

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 certstream.Entry)

Types

type BroadcastManager

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

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
}

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.

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.

Jump to

Keyboard shortcuts

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