Documentation
¶
Index ¶
- func FilterAuthCookies(cookies []*http.Cookie, authHost string) []*http.Cookie
- func Load(filename string) ([]*http.Cookie, error)
- func LoadUser(filename string) string
- func MatchDomain(cookieDomain, targetDomain string) bool
- func PrintStatus(cookies []*http.Cookie, asJSON bool, verified bool, verifiedValid bool, ...)
- func VerifyCookies(targetURL, authHost string, cookies []*http.Cookie, verifyCert bool) (bool, time.Duration)
- type CookieStatusJSON
- type Jar
- func (j *Jar) Save(filename string, cookies []*http.Cookie, domain string) error
- func (j *Jar) SaveWithUser(filename string, cookies []*http.Cookie, domain string, username string) error
- func (j *Jar) SetCookiesFromSlice(u *url.URL, cookies []*http.Cookie)
- func (j *Jar) Update(filename string, newCookies []*http.Cookie, domain string) error
- func (j *Jar) UpdateWithUser(filename string, newCookies []*http.Cookie, domain string, username string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterAuthCookies ¶
FilterAuthCookies returns cookies that belong to the auth hostname.
func LoadUser ¶
LoadUser reads the username from a cookie file if present. Returns empty string if no username is found or file doesn't exist.
func MatchDomain ¶
MatchDomain checks if a cookie domain matches the target domain. Cookie domain ".example.com" matches "sub.example.com" and "example.com". Cookie domain "example.com" matches only "example.com".
func PrintStatus ¶
func PrintStatus(cookies []*http.Cookie, asJSON bool, verified bool, verifiedValid bool, w io.Writer)
PrintStatus displays cookie information in either table or JSON format. If asJSON is true, output is in JSON format. Otherwise, a formatted table is shown. If verified is true, shows verification status instead of time-based expiry.
Types ¶
type CookieStatusJSON ¶
type CookieStatusJSON struct {
Name string `json:"name"`
Domain string `json:"domain"`
Path string `json:"path"`
Secure bool `json:"secure"`
HttpOnly bool `json:"http_only"`
Expires *string `json:"expires"`
Status string `json:"status"`
RemainingSeconds float64 `json:"remaining_seconds"`
Verified bool `json:"verified"`
VerifiedValid bool `json:"verified_valid,omitempty"`
}
CookieStatusJSON represents cookie data for JSON output.
type Jar ¶
Jar wraps http.CookieJar with persistence to Netscape format.
func (*Jar) SaveWithUser ¶
func (j *Jar) SaveWithUser(filename string, cookies []*http.Cookie, domain string, username string) error
SaveWithUser writes cookies to a file in Netscape format with username tracking. If username is provided, it's stored as a comment for later validation.
func (*Jar) SetCookiesFromSlice ¶
SetCookiesFromSlice sets cookies on the jar for a given URL.