proxy

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLoopback

func GetLoopback() selector.Node

func SetDefault

func SetDefault(proxy Proxy)

func SetLoopback

func SetLoopback(let selector.Node)

Types

type Option

type Option func(*ReverseProxy)

func WithActivateMock

func WithActivateMock(fn func(client *http.Client)) Option

WithActivateMock is activate httpmock

func WithDialer

func WithDialer(d *net.Dialer) Option

WithDialer is set custom net.Dialer

func WithInitialNodes

func WithInitialNodes(nodes []selector.Node) Option

WithInitialNodes is set initial nodes

func WithSelector

func WithSelector(s selector.Selector) Option

WithSelector is set new-selector

type Proxy

type Proxy interface {
	Do(req *http.Request, collapsed bool, waitTimeout time.Duration) (*http.Response, error)
	DoLoopback(req *http.Request) (*http.Response, error)
	Apply(nodes []selector.Node)
}

func GetProxy

func GetProxy() Proxy

type ReverseProxy

type ReverseProxy struct {
	// Rebalancer is nodes rebalancer.
	selector.Rebalancer
	*direct.Builder
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) *ReverseProxy

func (*ReverseProxy) Apply

func (r *ReverseProxy) Apply(nodes []selector.Node)

Apply is apply all nodes when any changes happen

func (*ReverseProxy) Do

func (r *ReverseProxy) Do(req *http.Request, collapsed bool, waitTimeout time.Duration) (*http.Response, error)

func (*ReverseProxy) DoLoopback

func (r *ReverseProxy) DoLoopback(req *http.Request) (*http.Response, error)

type Tuple

type Tuple struct {
	L *http.Response
	R []byte
}

Directories

Path Synopsis
Package singleflight provides a duplicate function call suppression mechanism.
Package singleflight provides a duplicate function call suppression mechanism.

Jump to

Keyboard shortcuts

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