demarkate

package module
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

README

demarkate

HTTP2 or 1.1 with h2c upgrade and HTTP2C (cleartext) reverse proxy to single H2c (e.g insecure gRPC), HTTP2 or HTTP1.1 endpoint.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EnvconfigPrefix = "DEMARKATE"

envconfig prefix

Functions

func Debug

func Debug(format string, v ...interface{})

func Error added in v1.2.0

func Error(format string, v ...interface{})

func Errorf

func Errorf(format string, v ...interface{})

func Fatal

func Fatal(format string, v ...interface{})

func Info added in v1.2.0

func Info(format string, v ...interface{})

wrapped logging functions for convenience, e.g: demarkate.Info("hello world")

func NewReverseProxy added in v1.2.0

func NewReverseProxy(cnf *Config) *httputil.ReverseProxy

func Panic

func Panic(format string, v ...interface{})

func Printf

func Printf(format string, v ...interface{})

func Start

func Start(cnf *Config) error

func Usage

func Usage()

func Warn added in v1.2.0

func Warn(format string, v ...interface{})

func Warning added in v1.2.0

func Warning(format string, v ...interface{})

Types

type BackendStruct added in v1.2.0

type BackendStruct struct {
	Filter   string
	Target   string
	URL      *url.URL
	HostGlob glob.Glob
	Path     string
}

type Config

type Config struct {
	Protocol           string          `envconfig:"PROTOCOL"`
	ListenTo           []string        `envconfig:"LISTEN_TO"`
	MaxConns           int             `envconfig:"MAX_CONNS"`
	MaxIdleConns       int             `envconfig:"MAX_IDLE_CONNS"`
	Timeout            time.Duration   `envconfig:"TIMEOUT"`
	ReadHeaderTimeout  time.Duration   `envconfig:"READHEADERTIMEOUT"`
	ReadTimeout        time.Duration   `envconfig:"READTIMEOUT"`
	WriteTimeout       time.Duration   `envconfig:"WRITETIMEOUT"`
	IdleTimeout        time.Duration   `envconfig:"IDLETIMEOUT"`
	Backend            string          `envconfig:"BACKEND"`
	Backends           []string        `envconfig:"BACKENDS"`
	BackendType        string          `envconfig:"BACKEND_TYPE"`
	BackendTimeout     time.Duration   `envconfig:"BACKEND_TIMEOUT"`
	CertFiles          []string        `envconfig:"CERT_FILES"`
	SelfSign           bool            `envconfig:"SELF_SIGN"`
	Organization       string          `envconfig:"SELF_SIGN_ORG"`
	CommonName         string          `envconfig:"SELF_SIGN_CN"`
	EnableMetrics      bool            `envconfig:"ENABLE_METRICS"`
	Prometheus         string          `envconfig:"PROMETHEUS"`
	MetricsPath        string          `envconfig:"METRICS_PATH"`
	UsageOnSyntaxError bool            `envconfig:"USAGE"`
	BackendStructs     []BackendStruct `ignored:"true"`
	URL                *url.URL        `ignored:"true"`
}

New() Config struct, envconfig prefix is DEMARKATE_, e.g DEMARKATE_LISTEN_TO=":1337" DEMARKATE_SELF_SIGN="true"

func New

func New(opts ...Option) Config

type Option

type Option func(cnf *Config)

func Backend

func Backend(backend string) Option

func BackendType

func BackendType(backendType string) Option

func CertFiles

func CertFiles(pemFiles []string) Option

func CommonName

func CommonName(cn string) Option

func EnvConfig

func EnvConfig() Option

func ListenTo

func ListenTo(socket_address string) Option

func MaxConns added in v1.1.0

func MaxConns(conns int) Option

func OnlyTCP4

func OnlyTCP4() Option

func OnlyTCP6

func OnlyTCP6() Option

func Organization

func Organization(org string) Option

func SelfSign

func SelfSign() Option

func Timeout added in v1.2.0

func Timeout(timeout time.Duration) Option

func UsageOnSyntaxError

func UsageOnSyntaxError(v bool) Option

type UTCFormatter

type UTCFormatter struct {
	log.Formatter
}

https://stackoverflow.com/a/40502637

func (UTCFormatter) Format

func (u UTCFormatter) Format(e *log.Entry) ([]byte, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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