module

package
v0.0.0-...-c99ed23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2017 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Salt = []byte(``)

	CookieKey = `tango_sesssion`

	CookieClean = http.Cookie{
		Domain:   domain,
		Name:     CookieKey,
		Value:    `deleted`,
		Path:     `/`,
		Expires:  time.Unix(0, 0),
		Secure:   true,
		HttpOnly: true,
		MaxAge:   -1,
	}
)

Functions

func SessionMakeHash

func SessionMakeHash(uid int64, session int64, time time.Time) []byte

func SetDomain

func SetDomain(s string)

Types

type Session

type Session struct {
	Uid     int64
	Session int64
	Time    time.Time
	User    *User
}

func SessionImport

func SessionImport(sCookie string) (user *Session, err error)

func SessionParse

func SessionParse(w http.ResponseWriter, r *http.Request) (s *Session)

func (*Session) GetUser

func (this *Session) GetUser() *User

func (*Session) MakeCookie

func (this *Session) MakeCookie() (c *http.Cookie)

func (*Session) Valid

func (this *Session) Valid() bool

type User

type User struct {
	Id int64
	// contains filtered or unexported fields
}

func UserCreate

func UserCreate(name, password string) (user *User, err error)

func UserLogin

func UserLogin(name, password string) (user *User, err error)

func (*User) Check

func (this *User) Check() (err error)

func (*User) Get

func (this *User) Get() (err error)

func (*User) Info

func (this *User) Info() *UserInfo

type UserInfo

type UserInfo struct {
	Id   int64
	Name string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL