verival

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2022 License: MIT Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

verival

Go

Documentation

Index

Constants

View Source
const InMemory = ":memory:"

Variables

View Source
var ErrInvalidValueCodec = errors.New("invalid value codec")
View Source
var ErrNewerValueExists = errors.New("newer value exists")

Functions

func JoinValueAndSign

func JoinValueAndSign(sign crypto.B64, value string) string

func NewMemoryStorage

func NewMemoryStorage() *storage

func Open

func Open(path string) (*storage, error)

func SplitValueAndSign

func SplitValueAndSign(joined string) (sign crypto.B64, value string, err error)

func TryEnableFastOpen added in v0.2.0

func TryEnableFastOpen(ln net.Listener)

Types

type Value

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

func NewValue

func NewValue(pk crypto.B64, time time.Time, pairs ...string) *Value

func ParseValue

func ParseValue(v string) (*Value, error)

func (*Value) Decode

func (v *Value) Decode() (url.Values, error)

func (*Value) MustSign

func (v *Value) MustSign(sk crypto.B64) *ValueWithSign

func (*Value) PK

func (v *Value) PK() crypto.B64

func (*Value) Sign

func (v *Value) Sign(sk crypto.B64) (*ValueWithSign, error)

func (*Value) String

func (v *Value) String() string

func (*Value) Time

func (v *Value) Time() time.Time

func (*Value) VerifySignature

func (v *Value) VerifySignature(sign crypto.B64) error

type ValueWithSign

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

func NewValueWithSign

func NewValueWithSign(val *Value, sign crypto.B64) *ValueWithSign

func ParseValueWithSign

func ParseValueWithSign(str string) (*ValueWithSign, error)

func (*ValueWithSign) Sign

func (vs *ValueWithSign) Sign() crypto.B64

func (*ValueWithSign) String

func (vs *ValueWithSign) String() string

func (*ValueWithSign) Value

func (vs *ValueWithSign) Value() *Value

func (*ValueWithSign) Verify

func (vs *ValueWithSign) Verify() error

type Verival

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

func NewVerival

func NewVerival(st *storage) *Verival

func (*Verival) FastHttpErrorHandler added in v0.2.0

func (vv *Verival) FastHttpErrorHandler(r *fasthttp.RequestCtx, err error)

func (*Verival) FastHttpHandler added in v0.2.0

func (vv *Verival) FastHttpHandler(r *fasthttp.RequestCtx)

func (*Verival) Get

func (vv *Verival) Get(pk crypto.B64) (*ValueWithSign, error)

func (*Verival) Put

func (vv *Verival) Put(data string) error

func (*Verival) ServeHTTP

func (vv *Verival) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Verival) ServeUDP added in v1.1.1

func (vv *Verival) ServeUDP(addr net.Addr)

Directories

Path Synopsis
cmd
verival-service command

Jump to

Keyboard shortcuts

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