Documentation
¶
Overview ¶
Package cookiejar implements an in-memory RFC 6265-compliant http.CookieJar.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Jar ¶
type Jar struct {
// contains filtered or unexported fields
}
Jar implements the http.CookieJar interface from the net/http package.
type Options ¶
type Options struct { // PublicSuffixList is the public suffix list that determines whether // an HTTP server can set a cookie for a domain. // // A nil value is valid and may be useful for testing but it is not // secure: it means that the HTTP server for foo.co.uk can set a cookie // for bar.co.uk. PublicSuffixList PublicSuffixList }
Options are the options for creating a new Jar.
type PersistentJar ¶
type PersistentJar struct {
// contains filtered or unexported fields
}
func NewPersistentJar ¶
func NewPersistentJar(opts ...PersistentJarOption) (*PersistentJar, error)
func (*PersistentJar) SetCookies ¶
func (c *PersistentJar) SetCookies(u *url.URL, cookies []*http.Cookie)
type PersistentJarConfig ¶
type PersistentJarConfig struct { *Options Filepath string `json:"filepath" yaml:"filepath"` Interval time.Duration `yaml:"interval" yaml:"interval"` }
func (PersistentJarConfig) Valid ¶
func (p PersistentJarConfig) Valid() error
type PersistentJarOption ¶
type PersistentJarOption interface {
// contains filtered or unexported methods
}
PersistentJarOption is an option to configure PersistentJarOptions.
func WithFilePath ¶
func WithFilePath(filePath string) PersistentJarOption
WithFilePath sets the file path.
func WithPublicSuffixList ¶
func WithPublicSuffixList(list PublicSuffixList) PersistentJarOption
WithPublicSuffixList sets the public suffix list.
func WithSyncInterval ¶
func WithSyncInterval(interval time.Duration) PersistentJarOption
WithSyncInterval sets sync time interval
type PublicSuffixList ¶
type PublicSuffixList interface { // PublicSuffix returns the public suffix of domain. // // TODO: specify which of the caller and callee is responsible for IP // addresses, for leading and trailing dots, for case sensitivity, and // for IDN/Punycode. PublicSuffix(domain string) string // String returns a description of the source of this public suffix // list. The description will typically contain something like a time // stamp or version number. String() string }
PublicSuffixList provides the public suffix of a domain. For example:
- the public suffix of "example.com" is "com",
- the public suffix of "foo1.foo2.foo3.co.uk" is "co.uk", and
- the public suffix of "bar.pvt.k12.ma.us" is "pvt.k12.ma.us".
Implementations of PublicSuffixList must be safe for concurrent use by multiple goroutines.
An implementation that always returns "" is valid and may be useful for testing but it is not secure: it means that the HTTP server for foo.com can set a cookie for bar.com.
A public suffix list implementation is in the package golang.org/x/net/publicsuffix.