Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var TestCases = []testCaseStruct{ { Config: config.Config{ Host: "localhost", Port: "8000", Backends: []config.Backend{ { Url: "localhost:8080", Weight: 1, }, { Url: "localhost:80", Weight: 1, }, }, HealthCheckerTime: time.Second * 5, HealthCheckerFunc: func(string) bool { return true }, HashFunc: func(b []byte) uint32 { return uint32(len(b)) }, }, ExpectedServerCount: 2, ProxyFunc: CreateNewMockProxy, }, { Config: config.Config{ Host: "localhost", Port: "8000", Backends: []config.Backend{ { Url: "localhost:8080", Weight: 1, }, }, HealthCheckerTime: time.Second * 5, HealthCheckerFunc: func(string) bool { return true }, HashFunc: func(b []byte) uint32 { return uint32(len(b)) }, }, ExpectedServerCount: 1, ProxyFunc: CreateNewMockProxy, }, { Config: config.Config{ Host: "localhost", Port: "8000", Backends: []config.Backend{ { Url: "localhost:8080", Weight: 1, }, { Url: "localhost:80", Weight: 1, }, }, HealthCheckerTime: time.Second * 5, HealthCheckerFunc: func(string) bool { return false }, HashFunc: func(b []byte) uint32 { return uint32(len(b)) }, }, ExpectedServerCount: 0, ProxyFunc: CreateNewMockProxy, }, { Config: config.Config{ Host: "localhost", Port: "8000", Backends: []config.Backend{}, HealthCheckerTime: time.Second * 5, HealthCheckerFunc: func(s string) bool { return false }, HashFunc: func(b []byte) uint32 { return uint32(len(b)) }, }, ExpectedServerCount: 0, ProxyFunc: CreateNewMockProxy, }, { Config: config.Config{ Host: "localhost", Port: "8000", Backends: []config.Backend{ { Url: "localhost:7070", Weight: 1, }, { Url: "localhost:80", Weight: 1, }, }, HealthCheckerTime: time.Second * 5, HealthCheckerFunc: func(string) bool { return true }, HashFunc: func(b []byte) uint32 { return uint32(len(b)) }, }, ExpectedServerCount: 2, ProxyFunc: CreateNewMockProxy, }, }
Functions ¶
func CreateNewMockProxy ¶
Types ¶
type MockProxy ¶
func (*MockProxy) AvgResponseTime ¶ added in v0.5.0
func (*MockProxy) PendingRequests ¶ added in v0.2.0
func (*MockProxy) ReverseProxyHandler ¶
func (m *MockProxy) ReverseProxyHandler(ctx *fasthttp.RequestCtx) error
Click to show internal directories.
Click to hide internal directories.