web

package
v0.0.0-...-af321b4 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// When attempt to reserve a request slot, if one isn't available but
	// the delay is less than SleepDelayThreshold, we do a time.Sleep()
	// to wait for the slot to open up. If the delay is greater than this
	// value, we return a 429 error and give the time slice back.
	SleepDelayThreshold = 10 * time.Millisecond

	// How many token should be in the request token bucket at a time, to
	// be returned at any time. We set this to 20, which means initially
	// a client can do 20 requests without an issue, and then they refill
	// the that rate per their account limits (which, at the time of writing
	// is 5 per second for guests)
	RequestBurst = 20
)

Functions

This section is empty.

Types

type Connector

type Connector interface {
	ConnectToService(
		ctx context.Context,
		target *pb.ServiceRoute,
		account *pb.Account,
		proto string,
		token string,
	) (wire.Context, error)
}

type Frontend

type Frontend struct {
	L hclog.Logger

	Checker HostnameChecker
	// contains filtered or unexported fields
}

func NewFrontend

func NewFrontend(L hclog.Logger, h Connector, cl *control.Client, token string) (*Frontend, error)

func (*Frontend) Serve

func (f *Frontend) Serve(l net.Listener) error

func (*Frontend) ServeHTTP

func (f *Frontend) ServeHTTP(w http.ResponseWriter, req *http.Request)

type HostnameChecker

type HostnameChecker interface {
	HandlingHostname(name string) bool
}

type TLS

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

func NewTLS

func NewTLS(L hclog.Logger, path, email string, test bool, storage certmagic.Storage, decision func(name string) error) (*TLS, error)

func (*TLS) ListenAndServe

func (t *TLS) ListenAndServe(addr string, h http.Handler) error

Jump to

Keyboard shortcuts

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