Documentation ¶
Index ¶
- Constants
- func UnpackHead(h []byte) (pkl, cmd, seq uint32)
- type AuthConf
- type IHead
- type Logger
- type MtOptions
- type Operation
- type OptionFunc
- func MtAtTime(t time.Time) OptionFunc
- func MtAtTimeStr(s string) OptionFunc
- func MtFeeCode(s string) OptionFunc
- func MtFeeTerminalId(id string) OptionFunc
- func MtFeeTerminalType(t uint8) OptionFunc
- func MtFeeType(s string) OptionFunc
- func MtFeeUsertype(t uint8) OptionFunc
- func MtLinkID(s string) OptionFunc
- func MtMsgLevel(l uint8) OptionFunc
- func MtNeedReport(tf uint8) OptionFunc
- func MtServiceId(id string) OptionFunc
- func MtSpSubNo(s string) OptionFunc
- func MtValidTime(s string) OptionFunc
- func WithMtOptions(opt *MtOptions) OptionFunc
- type Pdu
- type RequestPdu
- type Sequence32
- type Sequence64
- type SequenceBCD
Constants ¶
View Source
const ( Pkl = "pkl" // 数据包总长度 Cmd = "op" // 数据包类型(命令类型) Seq = "seq" // 序号(一对请求与响应序号相同) HeadLen uint32 = 12 PacketMax = 5120 )
Variables ¶
This section is empty.
Functions ¶
func UnpackHead ¶
Types ¶
type AuthConf ¶
type AuthConf 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协议所需服务端分配的用户名 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 MtOptions ¶
type MtOptions struct { NeedReport uint8 MsgLevel uint8 FeeUsertype uint8 FeeTerminalType uint8 ServiceId string FeeTerminalId string FeeType string FeeCode string ValidTime string AtTime string SpSubNo string LinkID string }
func LoadMtOptions ¶
func LoadMtOptions(ops ...OptionFunc) *MtOptions
type OptionFunc ¶
type OptionFunc func(mtOps *MtOptions)
func MtFeeTerminalId ¶
func MtFeeTerminalId(id string) OptionFunc
MtFeeTerminalId 计费号码与FeeTerminalType配合使用
func MtFeeTerminalType ¶
func MtFeeTerminalType(t uint8) OptionFunc
MtFeeTerminalType 被计费用户的号码类型,0:真实号码;1:伪码
func MtFeeType ¶
func MtFeeType(s string) OptionFunc
MtFeeType 资费类别 01:对“计费用户号码”免费 02:对“计费用户号码”按条计信息费 03:对“计费用户号码”按包月收取信息费 04:对“计费用户号码”的信息费封顶 05:对“计费用户号码”的收费是由SP实现
func MtFeeUsertype ¶
func MtFeeUsertype(t uint8) OptionFunc
MtFeeUsertype 计费用户类型字段 0:对目的终端MSISDN计费; 1:对源终端MSISDN计费; 2:对SP计费; 3:表示本字段无效,对谁计费参见Fee_terminal_Id 字段。
type RequestPdu ¶
type Sequence32 ¶
type Sequence32 interface {
NextVal() int32
}
Sequence32 32位序号生成器
var B32Seq Sequence32
type Sequence64 ¶
type Sequence64 interface {
NextVal() int64
}
Sequence64 64位序号生成器
var B64Seq Sequence64
type SequenceBCD ¶
type SequenceBCD interface {
NextVal() []byte
}
SequenceBCD BCD码序号生成器
var BcdSeq SequenceBCD
Click to show internal directories.
Click to hide internal directories.