Documentation ¶
Index ¶
- Constants
- func GenRandKey(strength int) []byte
- type CookieTracker
- type CookieUrlTracker
- type HeaderTracker
- type Id
- type IdGenerator
- type MemoryStore
- func (store *MemoryStore) Add(id Id) bool
- func (store *MemoryStore) Clear(id Id) bool
- func (store *MemoryStore) Del(id Id, key string) bool
- func (store *MemoryStore) Exist(id Id) bool
- func (store *MemoryStore) Get(id Id, key string) interface{}
- func (store *MemoryStore) Keys(id Id) ([]string, error)
- func (store *MemoryStore) Run() error
- func (store *MemoryStore) Set(id Id, key string, value interface{}) error
- func (store *MemoryStore) SetIdMaxAge(id Id, maxAge time.Duration)
- func (store *MemoryStore) SetMaxAge(maxAge time.Duration)
- type Options
- type Session
- func (session *Session) Del(key string) bool
- func (session *Session) Get(key string) interface{}
- func (session *Session) GetSession() *Session
- func (session *Session) Id() Id
- func (session *Session) InitSession(manager *Sessions, req *http.Request, rw http.ResponseWriter) error
- func (session *Session) IsValid() bool
- func (session *Session) Keys() ([]string, error)
- func (session *Session) Release()
- func (session *Session) Sessions() *Sessions
- func (session *Session) Set(key string, value interface{})
- func (session *Session) SetId(id Id)
- func (session *Session) SetMaxAge(maxAge time.Duration)
- type Sessioner
- type Sessions
- func (manager *Sessions) Exist(id Id) bool
- func (itor *Sessions) Handle(ctx *tango.Context)
- func (manager *Sessions) Invalidate(rw http.ResponseWriter, session *Session)
- func (manager *Sessions) Run() error
- func (manager *Sessions) Session(req *http.Request, rw http.ResponseWriter) *Session
- func (manager *Sessions) SessionFromID(id Id) *Session
- func (manager *Sessions) SetIdMaxAge(id Id, maxAge time.Duration)
- func (manager *Sessions) SetMaxAge(maxAge time.Duration)
- type Sessionser
- type Sha1Generator
- type Store
- type Tracker
- type UrlTracker
Constants ¶
View Source
const ( DefaultMaxAge = 30 * time.Minute DefaultSessionIdName = "SESSIONID" DefaultCookiePath = "/" )
Variables ¶
This section is empty.
Functions ¶
func GenRandKey ¶
Types ¶
type CookieTracker ¶
type CookieTracker struct { Name string MaxAge time.Duration Lock sync.Mutex Secure bool RootPath string Domain string }
CookieTracker provide sessionid from cookie
func NewCookieTracker ¶
func (*CookieTracker) Clear ¶
func (tracker *CookieTracker) Clear(rw http.ResponseWriter)
func (*CookieTracker) Set ¶
func (tracker *CookieTracker) Set(req *http.Request, rw http.ResponseWriter, id Id)
func (*CookieTracker) SetMaxAge ¶
func (tracker *CookieTracker) SetMaxAge(maxAge time.Duration)
type CookieUrlTracker ¶
type CookieUrlTracker struct {
CookieTracker
}
func NewCookieUrlTracker ¶
func NewCookieUrlTracker(name string, maxAge time.Duration, secure bool, rootPath string) *CookieUrlTracker
for SWFUpload ...
type HeaderTracker ¶
type HeaderTracker struct {
Name string
}
func NewHeaderTracker ¶
func NewHeaderTracker(name string) *HeaderTracker
func (*HeaderTracker) Clear ¶
func (tracker *HeaderTracker) Clear(rw http.ResponseWriter)
func (*HeaderTracker) Set ¶
func (tracker *HeaderTracker) Set(req *http.Request, rw http.ResponseWriter, id Id)
func (*HeaderTracker) SetMaxAge ¶
func (tracker *HeaderTracker) SetMaxAge(maxAge time.Duration)
type MemoryStore ¶
func NewMemoryStore ¶
func NewMemoryStore(maxAge time.Duration) *MemoryStore
func (*MemoryStore) Add ¶
func (store *MemoryStore) Add(id Id) bool
func (*MemoryStore) Clear ¶
func (store *MemoryStore) Clear(id Id) bool
func (*MemoryStore) Exist ¶
func (store *MemoryStore) Exist(id Id) bool
func (*MemoryStore) Get ¶
func (store *MemoryStore) Get(id Id, key string) interface{}
func (*MemoryStore) Run ¶
func (store *MemoryStore) Run() error
func (*MemoryStore) SetIdMaxAge ¶
func (store *MemoryStore) SetIdMaxAge(id Id, maxAge time.Duration)
func (*MemoryStore) SetMaxAge ¶
func (store *MemoryStore) SetMaxAge(maxAge time.Duration)
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func (*Session) GetSession ¶
func (*Session) InitSession ¶
type Sessioner ¶
type Sessioner interface { GetSession() *Session InitSession(*Sessions, *http.Request, http.ResponseWriter) error }
Sessioner Session interface
type Sessions ¶
type Sessions struct {
Options
}
func NewWithTimeout ¶
func (*Sessions) Invalidate ¶
func (manager *Sessions) Invalidate(rw http.ResponseWriter, session *Session)
func (*Sessions) SessionFromID ¶
type Sessionser ¶
type Sessionser interface {
SetSessions(*Sessions)
}
type Sha1Generator ¶
type Sha1Generator struct {
// contains filtered or unexported fields
}
func NewSha1Generator ¶
func NewSha1Generator(hashKey string) *Sha1Generator
func (*Sha1Generator) IsValid ¶
func (gen *Sha1Generator) IsValid(id Id) bool
type Store ¶
type Store interface { Add(id Id) bool Exist(id Id) bool Clear(id Id) bool Keys(id Id) ([]string, error) Get(id Id, key string) interface{} Set(id Id, key string, value interface{}) error Del(id Id, key string) bool SetMaxAge(maxAge time.Duration) SetIdMaxAge(id Id, maxAge time.Duration) Run() error }
type Tracker ¶
type Tracker interface { SetMaxAge(maxAge time.Duration) Get(req *http.Request) (Id, error) Set(req *http.Request, rw http.ResponseWriter, id Id) Clear(rw http.ResponseWriter) }
Tracker provide and set sessionid
type UrlTracker ¶
UrlTracker provide sessionid from url
func NewUrlTracker ¶
func NewUrlTracker(key string, replaceLink bool) *UrlTracker
func (*UrlTracker) Clear ¶
func (tracker *UrlTracker) Clear(rw http.ResponseWriter)
func (*UrlTracker) Set ¶
func (tracker *UrlTracker) Set(req *http.Request, rw http.ResponseWriter, id Id)
func (*UrlTracker) SetMaxAge ¶
func (tracker *UrlTracker) SetMaxAge(maxAge time.Duration)
Click to show internal directories.
Click to hide internal directories.