rproxy

package
v0.0.0-...-5e22790 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: MIT Imports: 19 Imported by: 1

Documentation

Index

Constants

View Source
const (
	CmdPause = command(iota)
	CmdUnpause
	CmdReload
	CmdStop
	CmdTerminateRawConnections
)
View Source
const (
	ProxyStopped = ProxyState(iota)
	ProxyStarting
	ProxyRunning
	ProxyPausing
	ProxyPaused
	ProxyStopping
)
View Source
const (
	// MaxConnections: not enforced, used only to ensure enough
	// space in request/release channels to make it easy to
	// measure current state.
	//
	// TODO: enforce?
	MaxConnections = 1000
)
View Source
const (
	RawCmdTerminateAll = RawProxyCmd(iota)
)
View Source
const (
	SanitizedPass = "[removed]"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddrDeadliner

type AddrDeadliner interface {
	SetDeadline(t time.Time) error
	Addr() net.Addr
}

type AddrSpec

type AddrSpec struct {
	Addr    string `json:"addr"`
	Pass    string `json:"pass"`
	TLS     bool   `json:"tls"`
	Network string `json:"network"`

	CertFile   string `json:"certfile"`
	KeyFile    string `json:"keyfile"`
	CACertFile string `json:"cacertfile"`
	SkipVerify bool   `json:"skipverify,omitempty"`
}

func (*AddrSpec) AsJSON

func (as *AddrSpec) AsJSON() string

func (*AddrSpec) Dial

func (as *AddrSpec) Dial() (net.Conn, error)

func (*AddrSpec) GetTLSConfig

func (as *AddrSpec) GetTLSConfig() *tls.Config

func (*AddrSpec) Listen

func (as *AddrSpec) Listen() (*Listener, error)

func (*AddrSpec) Prepare

func (as *AddrSpec) Prepare(name string, server bool) ErrorList

func (*AddrSpec) SanitizedForPublication

func (a *AddrSpec) SanitizedForPublication() *AddrSpec

type AdminUI

type AdminUI struct {
	Addr net.Addr
	// contains filtered or unexported fields
}

func NewAdminUI

func NewAdminUI(proxy *Proxy) *AdminUI

func (*AdminUI) Start

func (a *AdminUI) Start() error

func (*AdminUI) Stop

func (a *AdminUI) Stop()

type ClientHandler

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

func NewClientHandler

func NewClientHandler(cliConn *resp.Conn, proxy *Proxy) *ClientHandler

func (*ClientHandler) Run

func (ch *ClientHandler) Run()

type Config

type Config struct {
	Uplink          AddrSpec `json:"uplink"`
	Listen          AddrSpec `json:"listen"`
	ListenRaw       AddrSpec `json:"listen_raw"`
	Admin           AddrSpec `json:"admin"`
	ReadTimeLimitMs int64    `json:"read_time_limit_ms"`
	LogMessages     bool     `json:"log_messages"`
}

func (*Config) AsJSON

func (c *Config) AsJSON() string

func (*Config) Prepare

func (c *Config) Prepare() ErrorList

func (*Config) SanitizedForPublication

func (c *Config) SanitizedForPublication() *Config

func (*Config) ValidateSwitchTo

func (c *Config) ValidateSwitchTo(new *Config) error

type ConfigHolder

type ConfigHolder interface {
	ReloadConfig()
	GetConfig() *Config
}

type ConfigLoader

type ConfigLoader interface {
	Load() (*Config, error)
}

type ErrorList

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

func (*ErrorList) Add

func (l *ErrorList) Add(error string)

func (*ErrorList) Append

func (l *ErrorList) Append(other ErrorList)

func (*ErrorList) AsError

func (l *ErrorList) AsError() error

func (*ErrorList) Errors

func (l *ErrorList) Errors() []string

func (*ErrorList) Ok

func (l *ErrorList) Ok() bool

type FileConfigLoader

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

func NewFileConfigLoader

func NewFileConfigLoader(name string) *FileConfigLoader

func (*FileConfigLoader) Load

func (f *FileConfigLoader) Load() (*Config, error)

type InputConfigLoader

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

func NewInputConfigLoader

func NewInputConfigLoader(reader io.Reader) *InputConfigLoader

func (*InputConfigLoader) Load

func (c *InputConfigLoader) Load() (*Config, error)

type JsonHttpResponse

type JsonHttpResponse struct {
	Ok    bool   `json:"ok"`
	Error string `json:"error,omitempty"`
}

type Listener

type Listener struct {
	net.Listener
	// contains filtered or unexported fields
}

func (*Listener) Addr

func (l *Listener) Addr() net.Addr

func (*Listener) SetDeadline

func (l *Listener) SetDeadline(deadline time.Time) error

type Proxy

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

func NewProxy

func NewProxy(cl ConfigLoader) (*Proxy, error)

func (*Proxy) AdminAddr

func (proxy *Proxy) AdminAddr() net.Addr
func (proxy *Proxy) CallUplink(block func() (*resp.Msg, error)) (*resp.Msg, error)

func (*Proxy) GetConfig

func (proxy *Proxy) GetConfig() *Config

func (*Proxy) GetInfo

func (proxy *Proxy) GetInfo() *ProxyInfo

func (*Proxy) ListenAddr

func (proxy *Proxy) ListenAddr() net.Addr

func (*Proxy) ListenRawAddr

func (proxy *Proxy) ListenRawAddr() net.Addr

func (*Proxy) Pause

func (proxy *Proxy) Pause() error

func (*Proxy) Reload

func (proxy *Proxy) Reload() error

func (*Proxy) ReloadConfig

func (proxy *Proxy) ReloadConfig() error

func (*Proxy) RequiresClientAuth

func (proxy *Proxy) RequiresClientAuth() bool

func (*Proxy) Run

func (proxy *Proxy) Run()

func (*Proxy) SetState

func (proxy *Proxy) SetState(st ProxyState)

func (*Proxy) Start

func (proxy *Proxy) Start()

func (*Proxy) State

func (proxy *Proxy) State() ProxyState

func (*Proxy) Stop

func (proxy *Proxy) Stop() error

func (*Proxy) TerminateRawConnections

func (proxy *Proxy) TerminateRawConnections() error

func (*Proxy) Unpause

func (proxy *Proxy) Unpause() error

type ProxyChannels

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

type ProxyInfo

type ProxyInfo struct {
	ActiveRequests  int        `json:"active_requests"`
	WaitingRequests int        `json:"waiting_requests"`
	State           ProxyState `json:"state"`
	StateStr        string     `json:"state_str"`
	Config          *Config    `json:"config"`
	RawConnections  int        `json:"raw_connections"`
}

func (*ProxyInfo) SanitizedForPublication

func (p *ProxyInfo) SanitizedForPublication() *ProxyInfo

type ProxyState

type ProxyState int

func (ProxyState) IsAlive

func (s ProxyState) IsAlive() bool

func (ProxyState) IsStartingOrAlive

func (s ProxyState) IsStartingOrAlive() bool

func (ProxyState) String

func (s ProxyState) String() string

type RawHandler

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

func NewRawHandler

func NewRawHandler(conn net.Conn, proxy *Proxy) *RawHandler

func (*RawHandler) CliAddr

func (r *RawHandler) CliAddr() net.Addr
func (r *RawHandler) DialUplink() net.Conn

func (*RawHandler) Run

func (r *RawHandler) Run()

func (*RawHandler) Terminate

func (r *RawHandler) Terminate()

type RawProxy

type RawProxy struct {
	Addr net.Addr
	// contains filtered or unexported fields
}

func NewRawProxy

func NewRawProxy(proxy *Proxy) *RawProxy

func (*RawProxy) GetInfo

func (r *RawProxy) GetInfo() *RawProxyInfo

func (*RawProxy) Start

func (r *RawProxy) Start() error

func (*RawProxy) TerminateAll

func (r *RawProxy) TerminateAll()

type RawProxyCmd

type RawProxyCmd int

type RawProxyInfo

type RawProxyInfo struct {
	HandlerCnt int
}

type TestConfigHolder

type TestConfigHolder struct {
	GetConfigCallCnt    int
	ReloadConfigCallCnt int
	// contains filtered or unexported fields
}

func (*TestConfigHolder) GetConfig

func (ch *TestConfigHolder) GetConfig() *Config

func (*TestConfigHolder) ReloadConfig

func (ch *TestConfigHolder) ReloadConfig()

type TestConfigLoader

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

func NewTestConfigLoader

func NewTestConfigLoader(uplinkAddr string) *TestConfigLoader

func (*TestConfigLoader) Load

func (c *TestConfigLoader) Load() (*Config, error)

func (*TestConfigLoader) Replace

func (c *TestConfigLoader) Replace(conf *Config)

type TestRequest

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

func NewTestRequest

func NewTestRequest(proxy *Proxy, block func()) *TestRequest

func (*TestRequest) Do

func (r *TestRequest) Do()

Jump to

Keyboard shortcuts

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