{"modulePath":"github.com/andrewbytecoder/nmq","version":"v0.0.0-20261028105650-d8b0a59c570e","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package loadbalancer\n\n## Types\n\n```go\ntype NameHandler struct {\n\thttp.Handler\n\n\tName string\n}\n```\nNameHandler is a http.Handler with a name.\n\n```go\ntype Sticky struct {\n\t// contains filtered or unexported fields\n}\n```\nSticky 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.\n\n```go\nfunc NewSticky(cookieConfig dynamic.Cookie) *Sticky\n```\nNewSticky creates a new sticky instance\n\n```go\nfunc (s *Sticky) AddHandler(name string, h http.Handler)\n```\nAddHandler adds a http.Handler to the sticky pool\n\n```go\nfunc (s *Sticky) StickyHandler(req *http.Request) (*NameHandler, bool, error)\n```\nStickyHandler 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\n\n```go\nfunc (s *Sticky) WriteStickyCookie(rw http.ResponseWriter, name string) error\n```\nWriteStickyCookie writes a sticky cookie to the response to stick the client to the given handler name.\n\n","path":"github.com/andrewbytecoder/nmq/plugins/proxy/server/service/loadbalancer","name":"loadbalancer","synopsis":"","isRedistributable":true}
