upstream

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

README

Upstream

A simple upstream proxy designed for use within Loophole Labs projects

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDisabled   = errors.New("upstream is disabled")
	ErrMissingSNI = errors.New("missing SNI")
	ErrUnknownSNI = errors.New("unknown SNI")
)

Functions

This section is empty.

Types

type CertificateEvent

type CertificateEvent struct {
	// ID is the unique identifier of the certificate's domain
	ID string

	// Deleted indicates whether the certificate was deleted
	Deleted bool

	// CertURL is the URL of the certificate
	// If the certificate was deleted, this will be empty
	CertURL string

	// Domain is the domain of the certificate
	// If the certificate was deleted, this will be empty
	Domain string

	// Certificate is the certificate that was created or updated.
	// If the certificate was deleted, this will be nil
	Certificate tls.Certificate
}

CertificateEvent is the event that is emitted when a certificate is created, updated, or deleted

type Options

type Options struct {
	LogName       string
	Disabled      bool
	ListenAddress string
}

type Route

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

type RouteEvent

type RouteEvent struct {
	// ID is the unique identifier of the route, which is the domain name for
	// incoming requests
	ID string

	// Deleted indicates whether the route was deleted
	Deleted bool

	// Upstream is the upstream of the route
	Upstream string
}

RouteEvent is the event that is emitted when a new route is created, updated, or deleted

type Storage

type Storage interface {
	SubscribeToCertificates(ctx context.Context) <-chan *CertificateEvent
	ListCertificates(ctx context.Context, validDNSOnly bool) ([]CertificateEvent, error)
	SubscribeToRootCertificates(ctx context.Context) <-chan *CertificateEvent
	ListRootCertificates(ctx context.Context, validDNSOnly bool) ([]CertificateEvent, error)
	SubscribeToRoutes(ctx context.Context) <-chan *RouteEvent
	ListRoutes(ctx context.Context) ([]RouteEvent, error)
}

type Upstream

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

func New

func New(options *Options, storage Storage, logger *zerolog.Logger) (*Upstream, error)

func (*Upstream) Start

func (p *Upstream) Start() error

func (*Upstream) Stop

func (p *Upstream) Stop() error

Directories

Path Synopsis
internal
pkg

Jump to

Keyboard shortcuts

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