common

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAuthenticationExpired = errors.NewPublic("认证过期,请重新登录")
View Source
var ErrCodeFrequently = errors.NewPublic("您的验证码请求频繁,请稍后再试")
View Source
var ErrEmailInvalid = errors.NewPublic("邮箱验证码无效")
View Source
var ErrEmailNotExists = errors.NewPublic("该账户不存在或被冻结")
View Source
var ErrLoginInvalid = errors.NewPublic("登录验证无效")
View Source
var ErrLoginMaxFailures = errors.NewPublic("登录失败超出最大次数")
View Source
var ErrLoginNotExists = errors.NewPublic("登录账号不存在或被冻结")
View Source
var ErrSession = errors.NewPrivate("会话建立失败")
View Source
var ErrSessionInconsistent = errors.NewPublic("会话令牌不一致")
View Source
var ErrSmsInvalid = errors.NewPublic("短信验证码无效")
View Source
var ErrSmsNotExists = errors.NewPublic("该账户不存在或被冻结")
View Source
var ErrTotpInvalid = errors.NewPublic("口令验证码无效")

Functions

func Claims added in v0.1.0

func Claims(c *app.RequestContext) (claims passport.Claims)

func ClearAccessToken added in v0.1.0

func ClearAccessToken(c *app.RequestContext)

func Hmacsha256 added in v0.1.24

func Hmacsha256(s, key string) string

func HttpClient added in v0.1.24

func HttpClient(url string) *req.Client

func SetAccessToken added in v0.1.0

func SetAccessToken(c *app.RequestContext, ts string)

func Sha256hex added in v0.1.24

func Sha256hex(s string) string

Types

type APIPassport added in v0.1.16

type APIPassport = passport.Passport

type Extra added in v0.1.0

type Extra struct {
	IpAddress             string `yaml:"ip_address"`
	IpSecretId            string `yaml:"ip_secret_id"`
	IpSecretKey           string `yaml:"ip_secret_key" secret:"*"`
	Ipv6Address           string `yaml:"ipv6_address" json:"Ipv6Address"`
	Ipv6SecretId          string `yaml:"ipv6_secret_id" json:"Ipv6SecretId"`
	Ipv6SecretKey         string `yaml:"ipv6_secret_key" secret:"*" json:"Ipv6SecretKey"`
	SmsSecretId           string `yaml:"sms_secret_id"`
	SmsSecretKey          string `yaml:"sms_secret_key" secret:"*"`
	SmsSign               string `yaml:"sms_sign"`
	SmsAppId              string `yaml:"sms_app_id"`
	SmsRegion             string `yaml:"sms_region"`
	SmsPhoneBind          string `yaml:"sms_phone_bind"`
	SmsLoginVerify        string `yaml:"sms_login_verify"`
	EmqxHost              string `yaml:"emqx_host"`
	EmqxApiKey            string `yaml:"emqx_api_key"`
	EmqxSecretKey         string `yaml:"emqx_secret_key" secret:"*"`
	AccelerateAddress     string `yaml:"accelerate_address"`
	CamUin                string `yaml:"cam_uin"`
	*values.DynamicValues `yaml:"dynamic_values"`
}

type Inject added in v0.0.28

type Inject struct {
	V         *Values
	Mgo       *mongo.Client
	Db        *mongo.Database
	RDb       *redis.Client
	Nats      *nats.Conn
	JetStream nats.JetStreamContext
	KeyValue  nats.KeyValue
	Cipher    *cipher.Cipher
	Captcha   *captcha.Captcha
	Locker    *locker.Locker
	Transfer  *transfer.Client
}

type Values

type Values struct {
	Mode      string `env:"MODE" envDefault:"debug"`
	Hostname  string `env:"HOSTNAME"`
	Address   string `env:"ADDRESS"`
	Console   string `env:"CONSOLE,required"`
	Ip        string `env:"IP" envDefault:"X-Forwarded-For"`
	XDomain   string `env:"XDOMAIN" envDefault:""`
	Namespace string `env:"NAMESPACE,required"`
	Key       string `env:"KEY,required"`

	Database struct {
		Url   string `env:"URL,required"`
		Name  string `env:"NAME,required"`
		Redis string `env:"REDIS,required"`
	} `envPrefix:"DATABASE_"`

	Nats struct {
		Hosts []string `env:"HOSTS,required" envSeparator:","`
		Pub   string   `env:"PUB,required"`
		Nkey  string   `env:"NKEY,required"`
	} `envPrefix:"NATS_"`

	Influx struct {
		Url    string `env:"URL"`
		Org    string `env:"ORG"`
		Token  string `env:"TOKEN"`
		Bucket string `env:"BUCKET"`
	} `envPrefix:"INFLUX_"`

	Otlp struct {
		Endpoint string `env:"ENDPOINT,required"`
		Token    string `env:"TOKEN,required"`
	} `envPrefix:"OTLP_"`

	*Extra
}

func (Values) IsRelease added in v0.1.0

func (x Values) IsRelease() bool

func (Values) NameX added in v0.1.0

func (x Values) NameX(sep string, v ...string) string

Jump to

Keyboard shortcuts

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