common

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2022 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Active

type Active struct {
	// Token ID
	JTI string

	// User ID
	UID string
}

Active 授权用户标识

func GetActive

func GetActive(c *app.RequestContext) (data Active)

GetActive 获取授权用户标识

type App

type App struct {
	// 命名空间
	Namespace string `yaml:"namespace"`
	// 密钥
	Key string `yaml:"key"`
}

func (App) Name

func (x App) Name(v ...string) string

Name 生成空间名称

func (App) Queue

func (x App) Queue(v string) string

Queue 生成队列名称

func (App) Subject

func (x App) Subject(v string) string

Subject 生成主题名称

type Cors

type Cors struct {
	AllowOrigins     []string `yaml:"allowOrigins"`
	AllowMethods     []string `yaml:"allowMethods"`
	AllowHeaders     []string `yaml:"allowHeaders"`
	ExposeHeaders    []string `yaml:"exposeHeaders"`
	AllowCredentials bool     `yaml:"allowCredentials"`
	MaxAge           int      `yaml:"maxAge"`
}

type Database

type Database struct {
	Uri string `yaml:"uri"`
	Db  string `yaml:"db"`
}

type DynamicValues

type DynamicValues map[string]interface{}

DynamicValues 动态配置

func (DynamicValues) GetCloud

func (x DynamicValues) GetCloud() string

GetCloud 云平台 tencent:腾讯云;

func (DynamicValues) GetEmailHost

func (x DynamicValues) GetEmailHost() string

GetEmailHost 公共电子邮件服务 SMTP 地址

func (DynamicValues) GetEmailPassword

func (x DynamicValues) GetEmailPassword() string

GetEmailPassword 公共邮箱用户密码

func (DynamicValues) GetEmailPort

func (x DynamicValues) GetEmailPort() string

GetEmailPort SMTP 端口号(SSL)

func (DynamicValues) GetEmailUsername

func (x DynamicValues) GetEmailUsername() string

GetEmailUsername 公共邮箱用户 例如:support@example.com

func (DynamicValues) GetFeishuAppId

func (x DynamicValues) GetFeishuAppId() string

GetFeishuAppId 飞书应用 ID

func (DynamicValues) GetFeishuAppSecret

func (x DynamicValues) GetFeishuAppSecret() string

GetFeishuAppSecret 飞书应用密钥

func (DynamicValues) GetFeishuEncryptKey

func (x DynamicValues) GetFeishuEncryptKey() string

GetFeishuEncryptKey 飞书事件订阅安全校验数据密钥

func (DynamicValues) GetFeishuVerificationToken

func (x DynamicValues) GetFeishuVerificationToken() string

GetFeishuVerificationToken 飞书事件订阅验证令牌

func (DynamicValues) GetIpBlacklist

func (x DynamicValues) GetIpBlacklist() []string

GetIpBlacklist IP 黑名单 黑名单 IP 将禁止访问。

func (DynamicValues) GetIpLoginFailures

func (x DynamicValues) GetIpLoginFailures() int64

GetIpLoginFailures IP 最大登录失败次数 同 IP 连续 10 次登录失败后,锁定 IP(周期为锁定时间)。

func (DynamicValues) GetIpWhitelist

func (x DynamicValues) GetIpWhitelist() []string

GetIpWhitelist IP 白名单 白名单 IP 允许超出最大登录失败次数。

func (DynamicValues) GetLoginFailures

func (x DynamicValues) GetLoginFailures() int64

GetLoginFailures 用户最大登录失败次数 有限时间(锁定时间)内连续登录失败 5 次,锁定帐号。

func (DynamicValues) GetLoginTTL

func (x DynamicValues) GetLoginTTL() time.Duration

GetLoginTTL 登录锁定时间 锁定 15 分钟。

func (DynamicValues) GetOffice

func (x DynamicValues) GetOffice() string

GetOffice 办公平台 feishu:飞书;

func (DynamicValues) GetOpenapiKey

func (x DynamicValues) GetOpenapiKey() string

GetOpenapiKey 开放服务应用认证 Key API 网关应用认证方式 https://cloud.tencent.com/document/product/628/55088

func (DynamicValues) GetOpenapiSecret

func (x DynamicValues) GetOpenapiSecret() string

GetOpenapiSecret 开放服务应用认证密钥

func (DynamicValues) GetOpenapiUrl

func (x DynamicValues) GetOpenapiUrl() string

GetOpenapiUrl 开放服务地址

func (DynamicValues) GetPwdStrategy

func (x DynamicValues) GetPwdStrategy() int64

GetPwdStrategy 密码强度 0:无限制; 1:需要大小写字母; 2:需要大小写字母、数字; 3:需要大小写字母、数字、特殊字符

func (DynamicValues) GetPwdTTL

func (x DynamicValues) GetPwdTTL() time.Duration

GetPwdTTL 密码有效期(天) 密码有效期(天) 密码过期后强制要求修改密码,0:永久有效

func (DynamicValues) GetRedirectUrl

func (x DynamicValues) GetRedirectUrl() string

GetRedirectUrl 第三方免登授权码跳转地址

func (DynamicValues) GetSessionTTL

func (x DynamicValues) GetSessionTTL() time.Duration

GetSessionTTL 会话周期(秒) 用户在 1 小时 内没有操作,将结束会话。

func (DynamicValues) GetTencentCosBucket

func (x DynamicValues) GetTencentCosBucket() string

GetTencentCosBucket 腾讯云 COS 对象存储 Bucket(存储桶名称)

func (DynamicValues) GetTencentCosExpired

func (x DynamicValues) GetTencentCosExpired() time.Duration

GetTencentCosExpired 腾讯云 COS 对象存储预签名有效期,单位:秒

func (DynamicValues) GetTencentCosLimit

func (x DynamicValues) GetTencentCosLimit() int64

GetTencentCosLimit 腾讯云 COS 对象存储上传大小限制,单位:KB

func (DynamicValues) GetTencentCosRegion

func (x DynamicValues) GetTencentCosRegion() string

GetTencentCosRegion 腾讯云 COS 对象存储所属地域 例如:ap-guangzhou

func (DynamicValues) GetTencentSecretId

func (x DynamicValues) GetTencentSecretId() string

GetTencentSecretId 腾讯云 API 密钥 Id 建议用子账号分配需要的权限

func (DynamicValues) GetTencentSecretKey

func (x DynamicValues) GetTencentSecretKey() string

GetTencentSecretKey 腾讯云 API 密钥 Key

type Nats

type Nats struct {
	Hosts []string `yaml:"hosts"`
	Nkey  string   `yaml:"nkey"`
}

type Redis

type Redis struct {
	Uri string `yaml:"uri"`
}

type Values

type Values struct {
	// 应用设置
	App `yaml:"app"`

	// 跨域设置
	Cors `yaml:"cors"`

	// MongoDB 配置
	Database `yaml:"database"`

	// Redis 配置
	Redis `yaml:"redis"`

	// NATS 配置
	Nats `yaml:"nats"`

	// 动态配置
	DynamicValues `yaml:"-"`
}

Jump to

Keyboard shortcuts

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