proxy

package
v0.0.0-...-89c44d9 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	LogEntryCtx              = "log_entry"
	HeaderProxyAuthorization = "Proxy-Authorization"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientTimeouts

type ClientTimeouts struct {
	ReadTimeout     time.Duration `long:"read" env:"READ" default:"0s" description:"Client read timeout" json:"readTimeout"`
	WriteTimeout    time.Duration `long:"write" env:"WRITE" default:"0s" description:"Client write timeout" json:"writeTimeout"`
	KeepAlivePeriod time.Duration `long:"keepalive-period" env:"KEEPALIVE_PERIOD" default:"1m" description:"Client keepalive period" json:"keepAlivePeriod"`
}

type Config

type Config struct {
	AddrString string       `short:"a" long:"addr" env:"ADDR" description:"Proxy address" default:"localhost:3128" json:"addr"`
	Addr       *net.TCPAddr `no-flag:"yes" json:"-"`

	DownstreamProxyURLString   string   `` /* 181-byte string literal not displayed */
	DownstreamProxyURL         *url.URL `no-flag:"yes" json:"-"`
	DownstreamProxyDialRetries int      `` /* 201-byte string literal not displayed */

	DownstreamProxyAuth DownstreamProxyAuth `` /* 138-byte string literal not displayed */

	Kerberos Kerberos `group:"Kerberos options" namespace:"kerberos" env-namespace:"KERBEROS" json:"kerberos"`
	Timeouts Timeouts `group:"Timeouts" namespace:"timeouts" env-namespace:"TIMEOUTS" json:"timeouts"`

	PingURLString string   `` /* 136-byte string literal not displayed */
	PingURL       *url.URL `no-flag:"yes" json:"-"`

	Mode Mode `short:"m" long:"mode" env:"MODE" description:"Escobar mode" default:"auto" json:"mode"`
}

type DownstreamProxyAuth

type DownstreamProxyAuth struct {
	User     string `short:"u" long:"user" env:"USER" description:"Downstream Proxy user" json:"user"`
	Password string `short:"p" long:"password" env:"PASSWORD" description:"Downstream Proxy password" json:"password"`
	Keytab   string `short:"k" long:"keytab" env:"KEYTAB" description:"Downstream Proxy path to keytab-file" json:"keytab"`
}

type DownstreamProxyTimeouts

type DownstreamProxyTimeouts struct {
	DialTimeout     time.Duration `long:"dial" env:"DIAL" default:"10s" description:"Downstream proxy dial timeout" json:"dialTimeout"`
	ReadTimeout     time.Duration `long:"read" env:"READ" default:"0s" description:"Downstream proxy read timeout" json:"readTimeout"`
	WriteTimeout    time.Duration `long:"write" env:"WRITE" default:"0s" description:"Downstream proxy write timeout" json:"writeTimeout"`
	KeepAlivePeriod time.Duration `` /* 130-byte string literal not displayed */
}

type Kerberos

type Kerberos struct {
	Realm string `long:"realm" env:"REALM" description:"Kerberos realm" value-name:"EVIL.CORP" json:"realm"`

	KDCString string       `long:"kdc" env:"KDC" description:"Key Distribution Center (KDC) address" value-name:"kdc.evil.corp:88" json:"kdc"`
	KDC       *net.TCPAddr `no-flag:"yes" json:"-"`
}

func (*Kerberos) Reader

func (k *Kerberos) Reader() (io.Reader, error)

type Mode

type Mode string
const (
	AutoMode   Mode = "auto"
	ManualMode Mode = "manual"
	BasicMode  Mode = "basic"
)

type Proxy

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

func NewProxy

func NewProxy(logger *zap.Logger, config *Config, krb5cl *client.Client) *Proxy

NewProxy returns Proxy instance

func (*Proxy) CheckAuth

func (p *Proxy) CheckAuth() (bool, error)

CheckAuth checks auth against Ping URL; should be called after starting proxy server itself

func (*Proxy) Listen

func (p *Proxy) Listen() (net.Listener, error)

func (*Proxy) Serve

func (p *Proxy) Serve(l net.Listener) error

Serve serves HTTP requests.

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(rw http.ResponseWriter, req *http.Request)

func (*Proxy) Shutdown

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

Shutdown shuts down the HTTP server.

type ServerTimeouts

type ServerTimeouts struct {
	ReadTimeout       time.Duration `long:"read" env:"READ" default:"0s" description:"HTTP server read timeout" json:"readTimeout"`
	ReadHeaderTimeout time.Duration `long:"read-header" env:"READ_HEADER" default:"30s" description:"HTTP server read header timeout" json:"readHeaderTimeout"`
	WriteTimeout      time.Duration `long:"write" env:"WRITE" default:"0s" description:"HTTP server write timeout" json:"writeTimeout"`
	IdleTimeout       time.Duration `long:"idle" env:"IDLE" default:"1m" description:"HTTP server idle timeout" json:"idleTimeout"`
}

type Timeouts

type Timeouts struct {
	Server          ServerTimeouts          `group:"Server timeouts" namespace:"server" env-namespace:"SERVER" json:"server"`
	Client          ClientTimeouts          `group:"Client timeouts" namespace:"client" env-namespace:"CLIENT" json:"client"`
	DownstreamProxy DownstreamProxyTimeouts `group:"Downstream Proxy timeouts" namespace:"downstream" env-namespace:"DOWNSTREAM" json:"downstreamProxy"`
}

Jump to

Keyboard shortcuts

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