weboptions

package
v0.21.2 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package weboptions provides Options for configuring a web server

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LocalHostWithPort

func LocalHostWithPort(listenerTCPAddr *net.TCPAddr) string

LocalHostWithPort returns a properly formatted localhost address with port.

Types

type Hosts

type Hosts struct {
	Names    []string
	Internal []string
	External []string
}

Hosts configurations.

type Options

type Options struct {
	// Pprof turns on the pprof profiler accessible at /debug
	Pprof bool

	// SharedDir is the location of static web assets.
	SharedDir string

	// StaticHost is a url to use for static assets, like app.viam.com
	StaticHost string

	// SignalingAddress is where to listen to WebRTC call offers at.
	SignalingAddress string

	// SignalingDialOpts are the dial options to used for signaling.
	SignalingDialOpts []rpc.DialOption

	// FQDN is the FQDN of this host. It is assumed this FQDN is unique to
	// one robot.
	FQDN string

	// LocalFQDN is the local FQDN of this host used for UI links
	// and SDK connections. It is assumed this FQDN is unique to one
	// robot.
	LocalFQDN string

	// Debug turns on various debugging features. For example, the echo gRPC
	// service is added.
	Debug bool

	// WebRTC configures whether or not to instruct all clients to prefer to
	// WebRTC connections over direct gRPC connections.
	WebRTC bool

	// Network describes networking settings for the web server.
	Network config.NetworkConfig

	// Auth describes authentication and authorization settings for the web server.
	Auth config.AuthConfig

	// Managed signifies if this server is remotely managed (e.g. from some cloud service).
	Managed bool

	// Secure determines if sever communicates are secured or not.
	Secure bool

	// baked information when managed to make local UI simpler
	BakedAuthEntity string
	BakedAuthCreds  rpc.Credentials

	WebRTCOnPeerAdded   func(pc *webrtc.PeerConnection)
	WebRTCOnPeerRemoved func(pc *webrtc.PeerConnection)

	DisableMulticastDNS bool
}

Options are used for configuring the web server.

func FromConfig

func FromConfig(cfg *config.Config) (Options, error)

FromConfig returns an Options populated by the config passed in.

func New

func New() Options

New returns a default set of options which will have the web server run on config.DefaultBindAddress.

func (*Options) GetHosts

func (options *Options) GetHosts(listenerTCPAddr *net.TCPAddr) Hosts

GetHosts derives host configurations from options.

Jump to

Keyboard shortcuts

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