Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NameHandler ¶
NameHandler is a http.Handler with a name.
type Sticky ¶
type Sticky struct {
// contains filtered or unexported fields
}
Sticky ensures that client consistently interacts with the same HTTP handler by adding a sticky cookie to the response. This cookie allows subsequent requests from the same client to be routed to the same handler enabling session persistence across multiple requests.
func (*Sticky) AddHandler ¶
AddHandler adds a http.Handler to the sticky pool
func (*Sticky) StickyHandler ¶
StickyHandler returns the NameHandler corresponding to the sticky cookie if one It also returns a boolean which indicates if the sticky cookie has to be overwritten because it uses a deprecated hash algorithm
func (*Sticky) WriteStickyCookie ¶
func (s *Sticky) WriteStickyCookie(rw http.ResponseWriter, name string) error
WriteStickyCookie writes a sticky cookie to the response to stick the client to the given handler name.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package failover 实现故障转移(Failover)机制: 当主后端(handler)不可用或返回特定错误状态码时, 自动将请求转发给备用后端(fallbackHandler); 两个后端都不可用时返回 503 Service Unavailable。
|
Package failover 实现故障转移(Failover)机制: 当主后端(handler)不可用或返回特定错误状态码时, 自动将请求转发给备用后端(fallbackHandler); 两个后端都不可用时返回 503 Service Unavailable。 |
|
Package hrw 实现了 Highest Random Weight (HRW),即 Rendezvous Hashing 一致性哈希负载均衡算法。
|
Package hrw 实现了 Highest Random Weight (HRW),即 Rendezvous Hashing 一致性哈希负载均衡算法。 |
|
Package mirror 实现 HTTP 请求流量镜像(Traffic Mirroring)。
|
Package mirror 实现 HTTP 请求流量镜像(Traffic Mirroring)。 |