MCPcopy Create free account
hub / github.com/appleboy/loadbalancer-algorithms / NewProxy

Function NewProxy

proxy/proxy.go:20–26  ·  view source on GitHub ↗

NewProxy creates a new instance of Proxy with the specified address.

(name string, addr *url.URL)

Source from the content-addressed store, hash-verified

18
19// NewProxy creates a new instance of Proxy with the specified address.
20func NewProxy(name string, addr *url.URL) *Proxy {
21 return &Proxy{
22 name: name,
23 proxy: httputil.NewSingleHostReverseProxy(addr),
24 health: health.New(addr),
25 }
26}
27
28// Proxy represents a reverse proxy for load balancing algorithms.
29type Proxy struct {

Callers 12

TestNextServerFunction · 0.92
TestAddServersFunction · 0.92
TestRemoveAllFunction · 0.92
TestServersFunction · 0.92
TestRemoveServersFunction · 0.92
BenchmarkNextFunction · 0.92
BenchmarkNextParallelFunction · 0.92
BenchmarkAddServersFunction · 0.92
BenchmarkRemoveServersFunction · 0.92
BenchmarkServersFunction · 0.92
ExampleRoundRobinFunction · 0.92
TestProxy_ServeHTTPFunction · 0.85

Calls 1

NewFunction · 0.92

Tested by 12

TestNextServerFunction · 0.74
TestAddServersFunction · 0.74
TestRemoveAllFunction · 0.74
TestServersFunction · 0.74
TestRemoveServersFunction · 0.74
BenchmarkNextFunction · 0.74
BenchmarkNextParallelFunction · 0.74
BenchmarkAddServersFunction · 0.74
BenchmarkRemoveServersFunction · 0.74
BenchmarkServersFunction · 0.74
ExampleRoundRobinFunction · 0.74
TestProxy_ServeHTTPFunction · 0.68