internal

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	ServerNames []string `yaml:"serverNames"`
	ClientAuth  bool     `yaml:"clientAuth"`
	ClientCAs   string   `yaml:"clientCAs"`

	Addresses          []string      `yaml:"addresses"`
	UseTLS             bool          `yaml:"useTLS"`
	InsecureSkipVerify bool          `yaml:"insecureSkipVerify"`
	ForwardServerName  string        `yaml:"forwardServerName"`
	ForwardRootCAs     string        `yaml:"forwardRootCAs"`
	ForwardTimeout     time.Duration `yaml:"forwardTimeout"`
	// contains filtered or unexported fields
}

Backend encapsulates the data of one backend.

type Config

type Config struct {
	HTTPAddr string     `yaml:"httpAddr"`
	TLSAddr  string     `yaml:"tlsAddr"`
	CacheDir string     `yaml:"cacheDir"`
	Backends []*Backend `yaml:"backends"`
	Email    string     `yaml:"email"`
	MaxOpen  int        `yaml:"maxOpen"`
}

Config is the TLS proxy configuration.

func ReadConfig

func ReadConfig(filename string) (*Config, error)

ReadConfig reads and validates a YAML config file.

type Proxy

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

Proxy receives TLS connections and forwards them to the configured backends.

func New

func New(cfg *Config) (*Proxy, error)

New returns a new initialized Proxy.

func (*Proxy) Reconfigure

func (p *Proxy) Reconfigure(cfg *Config) error

Reconfigure updates the proxy's configuration. Some parameters cannot be changed after Start has been called, e.g. HTTPAddr, TLSAddr, CacheDir.

func (*Proxy) Start

func (p *Proxy) Start(ctx context.Context) error

Start starts a TLS proxy with the given configuration. The proxy runs in background until the context is canceled.

func (*Proxy) Stop

func (p *Proxy) Stop()

Stop signals the background goroutines to exit.

Jump to

Keyboard shortcuts

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