cookie

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CookieName cookie key name
	CookieName = "v2ray_web_session"
)

Variables

This section is empty.

Functions

func Decode

func Decode(name, value string, dst interface{}) error

Decode decode cookie

func Encode

func Encode(name string, value interface{}) (string, error)

Encode encode cookie

func Init

func Init(secret string, maxAge time.Duration) (e error)

Init initialize cookie system

func IsInit

func IsInit() bool

IsInit return is init ?

func MaxAge

func MaxAge() int64

MaxAge return max age of timeout

Types

type Session

type Session struct {
	Name string `json:"name,omitempty" xml:"name,omitempty" yaml:"name,omitempty"`
	Root bool   `json:"root,omitempty" xml:"root,omitempty" yaml:"root,omitempty"`
}

Session user session info

func FromCookie

func FromCookie(val string) (session *Session, e error)

FromCookie restore session from cookie

func (*Session) Cookie

func (s *Session) Cookie() (string, error)

Cookie encode to cookie

func (*Session) String added in v1.2.0

func (s *Session) String() string

Cookie encode to cookie

Jump to

Keyboard shortcuts

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