guard

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blacklist

type Blacklist interface {
	Black(string, time.Duration) error // 将牌照加入黑名单
	Checklist(string) (bool, error)    // 检查牌照是否在黑名单列表中
}

Blacklist 黑名单列表

type Guard

type Guard interface {
	License(*User) (string, error) // 发行牌照
	GetLicense(UserType, int64) (string, error)
	Verify(string) (*User, error) // 验证牌照
	Cancellation(string) error    // 吊销牌照
	ExpiresAt(string) int64       // 获取牌照有效时间
	IssuerAt(string) int64        // 获取牌照发行时间
}

Guard API 入口守卫

type User

type User struct {
	Id   int64    `json:"id"`
	Type UserType `json:"type"`
}

type UserType

type UserType int
const (
	Admin UserType = iota + 1
	GeneralUser
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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