lolly/internal/loadbalance/sticky_config.go
xfy f69a11ea05 feat(loadbalance): implement Session Sticky balancer
- Add 256-shard lock map for concurrent session routing
- Cookie-based session persistence with base64 encoding
- TTL expiration with background cleanup goroutine
- Support Secure, HttpOnly, SameSite cookie attributes
- Fallback to configured balancer when session target unavailable
2026-06-08 17:30:06 +08:00

25 lines
563 B
Go

package loadbalance
import "time"
type StickyConfig struct {
Enabled bool `yaml:"enabled"`
Name string `yaml:"name"`
Expires time.Duration `yaml:"expires"`
Domain string `yaml:"domain"`
Path string `yaml:"path"`
Secure bool `yaml:"secure"`
HttpOnly bool `yaml:"http_only"`
SameSite string `yaml:"same_site"`
}
func DefaultStickyConfig() StickyConfig {
return StickyConfig{
Name: "lolly_route",
Expires: time.Hour,
Path: "/",
HttpOnly: true,
SameSite: "Lax",
}
}