mirror of
https://github.com/caddyserver/caddy.git
synced 2025-06-24 18:11:23 +08:00
added ip_hash load balancing
updated tests fixed comment format fixed formatting, minor logic fix added newline to EOF updated logic, fixed tests added comment updated formatting updated test output fixed typo
This commit is contained in:
@ -27,7 +27,7 @@ type Upstream interface {
|
||||
// The path this upstream host should be routed on
|
||||
From() string
|
||||
// Selects an upstream host to be routed to.
|
||||
Select() *UpstreamHost
|
||||
Select(*http.Request) *UpstreamHost
|
||||
// Checks if subpath is not an ignored path
|
||||
AllowedPath(string) bool
|
||||
}
|
||||
@ -93,7 +93,7 @@ func (p Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) (int, error) {
|
||||
// hosts until timeout (or until we get a nil host).
|
||||
start := time.Now()
|
||||
for time.Now().Sub(start) < tryDuration {
|
||||
host := upstream.Select()
|
||||
host := upstream.Select(r)
|
||||
if host == nil {
|
||||
return http.StatusBadGateway, errUnreachable
|
||||
}
|
||||
|
Reference in New Issue
Block a user