Documentation
¶
Index ¶
Constants ¶
const ( // These limits apply to persistent session state. The file limit bounds // input before JSON decoding; the serialized limit bounds the cookie data // itself before an atomic save. MaxSessionFileBytes = 2 << 20 MaxSessionCookies = 2048 MaxCookiesPerDomain = 64 MaxCookieNameBytes = 256 MaxCookieValueBytes = 4096 MaxSerializedSessionBytes = 1 << 20 )
Variables ¶
This section is empty.
Functions ¶
func IsValidName ¶
IsValidName returns true if the session name contains only alphanumeric characters, hyphens, and underscores.
Types ¶
type Session ¶
type Session struct {
Name string
Cookies []SessionCookie
// contains filtered or unexported fields
}
Session represents a named cookie session.
func Load ¶
Load loads a session from disk or creates a new empty session. Expired cookies are filtered out on load.
func LoadReadOnly ¶ added in v0.28.0
LoadReadOnly loads a session without creating or modifying its directory. It is used by dry-run so presentation can include existing cookies without changing session state merely because the configured directory is absent.
func (*Session) Save ¶
Save merges this session's changes with the latest on-disk state and then atomically commits the result. This prevents concurrent fetch processes from losing cookie updates or deletions.
func (*Session) TakeDiagnostics ¶ added in v0.28.0
TakeDiagnostics returns and clears bounded diagnostics generated while response cookies were processed or a session was saved.
type SessionCookie ¶
type SessionCookie struct {
Name string `json:"name"`
Value string `json:"value"`
Domain string `json:"domain"`
HostOnly bool `json:"host_only,omitzero"`
Path string `json:"path,omitzero"`
Expires time.Time `json:"expires,omitzero"`
Secure bool `json:"secure,omitzero"`
HttpOnly bool `json:"http_only,omitzero"`
SameSite string `json:"same_site,omitzero"`
}
SessionCookie represents a JSON-serializable cookie.