cookie

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 2 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// StoreName is the name of the cookie store.
	StoreName = "edgeagent_wallet"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	AuthKey []byte
	EncKey  []byte
	MaxAge  int
}

Config the cookie store.

type Jar

type Jar interface {
	Set(k interface{}, v interface{})
	Get(k interface{}) (interface{}, bool)
	Delete(k interface{})
	Save(*http.Request, http.ResponseWriter) error
}

Jar is a container of cookies from a Jars.

type Jars

type Jars struct {
	// contains filtered or unexported fields
}

Jars is a collection of cookie Jars.

func NewStore

func NewStore(config *Config) *Jars

NewStore returns a new CookieStore.

func (*Jars) Open

func (cs *Jars) Open(r *http.Request) (Jar, error)

Open the Jar.

type MockJar

type MockJar struct {
	Cookies map[interface{}]interface{}
	SaveErr error
}

MockJar is a mock Jar.

func (*MockJar) Delete

func (m *MockJar) Delete(k interface{})

Delete the cookie.

func (*MockJar) Get

func (m *MockJar) Get(k interface{}) (interface{}, bool)

Get the cookie.

func (*MockJar) Save

func (m *MockJar) Save(_ *http.Request, _ http.ResponseWriter) error

Save changes to the Jar.

func (*MockJar) Set

func (m *MockJar) Set(k, v interface{})

Set the cookie.

type MockStore

type MockStore struct {
	Jar     Jar
	OpenErr error
}

MockStore is a mock cookie Store.

func (*MockStore) Open

func (m *MockStore) Open(_ *http.Request) (Jar, error)

Open returns a Jar.

type Session

type Session struct {
	// contains filtered or unexported fields
}

Session is a Jar holding cookies.

func (*Session) Delete

func (s *Session) Delete(k interface{})

Delete the cookie.

func (*Session) Get

func (s *Session) Get(k interface{}) (interface{}, bool)

Get the cookie.

func (*Session) Save

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

Save changes to the Jar.

func (*Session) Set

func (s *Session) Set(k, v interface{})

Set the cookie.

type Store

type Store interface {
	Open(*http.Request) (Jar, error)
}

Store contains cookie jars.

Jump to

Keyboard shortcuts

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