session

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatConnect stat = iota
	StatLogin
	StatClosing

	CMPP = "cmpp"
	SGIP = "sgip"
	SMGP = "smgp"
)

Variables

View Source
var MsgIdResultCacheMap sync.Map

MsgIdResultCacheMap 临时存储短信发送的返回结果数据,Key为msgId,value为*Result,后续采用数据库存储

View Source
var SequenceIdResultCacheMap sync.Map

SequenceIdResultCacheMap 临时存储短信发送的返回结果数据,Key为requestId,value为*Result,后续采用数据库存储

Functions

This section is empty.

Types

type Result

type Result struct {
	QueryId      int64     `json:"QueryId"`      // 给客户端用的查询编号
	Phone        string    `json:"phone"`        // 手机号
	SequenceId   uint32    `json:"sequenceId"`   // 消息发送的标识
	Result       uint32    `json:"result"`       // 消息发送的网关响应码
	MsgId        string    `json:"msgId"`        // 消息的msgId用于关联状态报告
	Report       string    `json:"report"`       // DELIVRD 等7直接状态码
	SendTime     time.Time `json:"sendTime"`     // 发送时间
	ResponseTime time.Time `json:"responseTime"` // 网关响应时间
	ReportTime   time.Time `json:"reportTime"`   // 状态报告时间
}

type Session

type Session struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewSession

func NewSession(isp string, cli *auth.Client, con net.Conn) *Session

NewSession 创建一个新会话并登录,且启动定时器和接收服务

func (*Session) ActiveTest

func (s *Session) ActiveTest() error

func (*Session) AddCounter

func (s *Session) AddCounter()

func (*Session) AddCounterN

func (s *Session) AddCounterN(n uint64)

func (*Session) Close

func (s *Session) Close()

func (*Session) HealthCheck

func (s *Session) HealthCheck() bool

func (*Session) LruPriority

func (s *Session) LruPriority() uint64

LruPriority 最近最少使用的优先级最高

func (*Session) ResetCounter

func (s *Session) ResetCounter()

func (*Session) Send

func (s *Session) Send(phone string, message string) []any

Send 发送短信

Jump to

Keyboard shortcuts

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