common

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package common contains utility code that is common between HTTP and RPC interfaces.

Index

Constants

This section is empty.

Variables

Set is used by wire.

Functions

This section is empty.

Types

type BusyLatch

type BusyLatch struct{ *latch.Counter }

BusyLatch holds a latch.Counter when there is an active request.

func ProvideBusyLatch

func ProvideBusyLatch(auto promauto.Factory) BusyLatch

ProvideBusyLatch is called by wire.

type Config

type Config struct {
	AssumeSecure       bool          // Treat all incoming connections as though they were secure.
	BindAddr           string        // The network address to bind the API to.
	CertBundle         string        // A path to a certificate bundle file.
	DebugAddr          string        // If set serve additional debugging endpoints.
	GenerateSelfSigned bool          // If true, a self-signed certificate will be created.
	GracePeriod        time.Duration // The time to allow connections to drain.
	PrivateKey         string        // A path to a private key file.

	OIDC struct {
		ClientID     string
		ClientSecret string
		Domains      []string // Allowable domains for provisioning
		Issuer       string   // OIDC discovery URL
	}
}

Config contains all of the flag-worthy configuration for a Server.

func (*Config) Bind

func (c *Config) Bind(flags *pflag.FlagSet)

Bind adds flags to the FlagSet.

func (*Config) IsSecure

func (c *Config) IsSecure(r *http.Request) bool

IsSecure returns true if the request should be considered secure.

type VHostMap

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

VHostMap resolves hostnames against the virtual-host configuration in order to return the relevant VHost entry into calling contexts.

func ProvideVHostMap

func ProvideVHostMap(
	ctx context.Context,
	logger *log.Logger,
	vhosts vhost.VHostsServer,
) (*VHostMap, func(), error)

ProvideVHostMap is called by wire.

func (*VHostMap) Resolve

func (m *VHostMap) Resolve(hostname string) *vhost.VHost

Resolve maps the hostname to a VHost, or returns nil if no mapping is available.

Jump to

Keyboard shortcuts

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