auth

package module
v0.0.0-...-a86be45 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: MIT Imports: 10 Imported by: 3

Documentation

Index

Constants

View Source
const (
	DBN        = "smsdb"
	Collection = "authenticatedClients"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ISP             string        `yaml:"isp"               json:"isp"`             // 即运营商标识 cmpp、sgip、smgp
	ClientId        string        `yaml:"client-id"         json:"clientId"`        // 即SourceAddr
	LoginName       string        `yaml:"login-name"        json:"loginName"`       // SGIP协议所需服务端分配的用户名
	SharedSecret    string        `yaml:"shared-secret"     json:"sharedSecret"`    // 通讯密码
	Version         byte          `yaml:"version"           json:"version"`         // 见CMPP协议,48表示3.0 即 0x30 = 0011 0000
	NeedReport      byte          `yaml:"need-report"       json:"needReport"`      // 是否需状态报告
	SmsDisplayNo    string        `yaml:"sms-display-no"    json:"smsDisplayNo"`    // 发送号码(后面可拼接子码)
	ServiceId       string        `yaml:"service-id"        json:"serviceId"`       // 运营商分配的服务ID
	DefaultMsgLevel byte          `yaml:"default-msg-level" json:"DefaultMsgLevel"` // 默认短信优先级 (范围1-9)
	FeeUserType     byte          `yaml:"fee-user-type"     json:"feeUserType"`     // 费用相关
	FeeTerminalType byte          `yaml:"fee-terminal-type" json:"FeeTerminalType"` // 费用相关
	FeeTerminalId   string        `yaml:"fee-terminal-id"   json:"feeTerminalId"`   // 费用相关
	FeeType         string        `yaml:"fee-type"          json:"feeType"`         // 费用相关
	FeeCode         string        `yaml:"fee-code"          json:"feeCode"`         // 费用相关
	FixedFee        string        `yaml:"fixed-fee"         json:"fixedFee"`        // 费用相关
	LinkId          string        `yaml:"link-id"           json:"LinkId"`          // 点播业务相关
	MtValidDuration time.Duration `yaml:"mt-valid-duration" json:"mtValidDuration"` // 短信默认有效期,超过下面配置时长后,如果消息未发送,则不再发送
	MaxConns        int           `yaml:"max-conns"         json:"maxConns"`        // 最大连接数
	MtWindowSize    int           `yaml:"mt-window-size"    json:"mtWindowSize"`    // 接收窗口大小,服务端分配
	Throughput      int           `yaml:"throughput"        json:"throughput"`      // 系统最大吞吐,单位tps
}

type MongoStore

type MongoStore storage

func (*MongoStore) FindByCid

func (m *MongoStore) FindByCid(isp string, cid string) (c *Client)

func (*MongoStore) Load

func (m *MongoStore) Load()

type Store

type Store interface {
	// Load 从存储加载客户端配置信息
	Load()
	// FindByCid 根据客户端ID获取指定客户端配置信息:
	// isp 运营商,用协议名称表示 CMPP、SGIP、SMGP
	FindByCid(isp string, cid string) *Client
}
var Cache Store

Cache 从存储加载的客户端缓存数据

func New

func New(c yaml_config.YmlConfig) (cache Store)

type YamlStore

type YamlStore storage

func (*YamlStore) FindByCid

func (y *YamlStore) FindByCid(isp string, cid string) *Client

func (*YamlStore) Load

func (y *YamlStore) Load()

Jump to

Keyboard shortcuts

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