Documentation ¶
Index ¶
- type Cipher
- type CookieMan
- func (c *CookieMan) Clear(w http.ResponseWriter, name string)
- func (c *CookieMan) Get(r *http.Request, name string) ([]byte, error)
- func (c *CookieMan) NewCookieStore(name string, opt *CookieOption) *CookieStore
- func (c *CookieMan) Set(w http.ResponseWriter, name string, value []byte, opt *CookieOption) error
- type CookieOption
- type CookieStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cipher ¶
type Cipher interface { Encrypt(plaintext []byte) ([]byte, error) Decrypt(ciphertext []byte) ([]byte, error) }
Cipher is crypt interface to encrypt/decrypt cookie.
type CookieMan ¶
type CookieMan struct {
// contains filtered or unexported fields
}
CookieMan manages cookies.
func New ¶
func New(cipher Cipher, defaultOpt CookieOption) *CookieMan
New returns new CookieMan with default cookie option.
func (*CookieMan) Clear ¶
func (c *CookieMan) Clear(w http.ResponseWriter, name string)
Clear clears a cookie with given name.
func (*CookieMan) NewCookieStore ¶
func (c *CookieMan) NewCookieStore(name string, opt *CookieOption) *CookieStore
NewCookieStore returns new CookieStore which manages cookie whose key is given name and with given cookie option.
func (*CookieMan) Set ¶
func (c *CookieMan) Set(w http.ResponseWriter, name string, value []byte, opt *CookieOption) error
Set sets cookie.
type CookieOption ¶
CookieOption represents cookie options.
type CookieStore ¶
type CookieStore struct {
// contains filtered or unexported fields
}
CookieStore stores a cookie.
func (*CookieStore) Clear ¶
func (cs *CookieStore) Clear(w http.ResponseWriter)
Clear clears the cookie.
func (*CookieStore) Get ¶
func (cs *CookieStore) Get(r *http.Request) ([]byte, error)
Get returns cookie value.
func (*CookieStore) Name ¶
func (cs *CookieStore) Name() string
Name returns the cookie name this CookieStore manages.
func (*CookieStore) Set ¶
func (cs *CookieStore) Set(w http.ResponseWriter, value []byte) error
Set sets cookie value.
Click to show internal directories.
Click to hide internal directories.