redis

package
v1.17.3 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2023 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const Nil = redis.Nil

Variables

View Source
var AppCode = AppCodeHelper{
	// contains filtered or unexported fields
}
View Source
var Client *redis.Client

Functions

func NewMfaLogin

func NewMfaLogin(uid uint) tokenStore.TokenStore

func NewThirdPartyLogin

func NewThirdPartyLogin() tokenStore.TokenStore

func NewU2F

func NewU2F(uid uint) tokenStore.TokenStore

func PublishSshDev added in v1.16.14

func PublishSshDev(messages []rpcModel.SshAccountMsg) error

func SubScribeSshDev added in v1.16.14

func SubScribeSshDev() *redis.PubSub

Types

type AppCodeHelper

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

func (AppCodeHelper) Add

func (a AppCodeHelper) Add(data ...string) error

func (AppCodeHelper) Del

func (a AppCodeHelper) Del(data ...string) error

func (AppCodeHelper) Exist

func (a AppCodeHelper) Exist(data string) (bool, error)

func (AppCodeHelper) IsEmpty

func (a AppCodeHelper) IsEmpty() (bool, error)

func (AppCodeHelper) Load

func (a AppCodeHelper) Load() ([]string, error)

type MfaEnable

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

func NewMfaEnable

func NewMfaEnable(uid uint) MfaEnable

func (MfaEnable) Del

func (a MfaEnable) Del() error

func (MfaEnable) Get

func (a MfaEnable) Get() (string, error)

func (MfaEnable) Set

func (a MfaEnable) Set(secret string, valid time.Duration) error

type Passkey

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

func NewPasskey

func NewPasskey(ip string) Passkey

func (Passkey) NewUser

func (p Passkey) NewUser(id uint) UserPasskey

func (Passkey) ReadSession

func (p Passkey) ReadSession(ctx context.Context, session any) error

ReadSession 读取后自动销毁

func (Passkey) StoreSession

func (p Passkey) StoreSession(ctx context.Context, session any, expire time.Duration) error

type Sms

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

func NewSms

func NewSms(phone string) Sms

func (Sms) IsLocked

func (a Sms) IsLocked() (bool, error)

func (Sms) TryLock

func (a Sms) TryLock() (bool, error)

func (Sms) UnLock

func (a Sms) UnLock() error

type SyncStat

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

func NewSyncStat

func NewSyncStat(name string) SyncStat

func (*SyncStat) Inject

func (a *SyncStat) Inject(schedule cron.Schedule, f func() error) func() error

Inject 注入 backoff 内容函数,使其支持分布式锁与成功跳过

func (*SyncStat) SetSuccess

func (a *SyncStat) SetSuccess(ctx context.Context, expire time.Duration) error

func (*SyncStat) ShouldLock

func (a *SyncStat) ShouldLock(ctx context.Context, expire time.Duration) (bool, error)

func (*SyncStat) Succeed

func (a *SyncStat) Succeed(ctx context.Context) (bool, error)

func (*SyncStat) TryLock

func (a *SyncStat) TryLock(ctx context.Context, expire time.Duration) (bool, error)

func (*SyncStat) Unlock

func (a *SyncStat) Unlock(ctx context.Context) error

type UserIdentityCode

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

func NewUserIdentityCode

func NewUserIdentityCode(uid uint) UserIdentityCode

func (UserIdentityCode) Destroy

func (a UserIdentityCode) Destroy() error

func (UserIdentityCode) New

func (a UserIdentityCode) New() (string, error)

New 新建身份校验码,五分钟有效,每用户仅存在一个

func (UserIdentityCode) VerifyAndDestroy

func (a UserIdentityCode) VerifyAndDestroy(code string) (bool, error)

VerifyAndDestroy 校验并销毁 code

type UserJwt

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

func NewUserJwt

func NewUserJwt(uid uint) UserJwt

func (UserJwt) Clear

func (a UserJwt) Clear() error

func (UserJwt) Pair

func (a UserJwt) Pair(iat time.Time) (bool, error)

func (UserJwt) Set

func (a UserJwt) Set(iat time.Time, valid time.Duration) error

type UserPasskey

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

func (UserPasskey) ReadSession

func (u UserPasskey) ReadSession(ctx context.Context, session any) error

func (UserPasskey) StoreSession

func (u UserPasskey) StoreSession(ctx context.Context, session any, expire time.Duration) error

Jump to

Keyboard shortcuts

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