Versions in this module Expand all Collapse all v1 v1.0.1 Nov 16, 2021 v1.0.0 Nov 11, 2021 Changes in this version type SmgpSubmitReqPkt + func GetMsgPkgs(pkg *SmgpSubmitReqPkt) ([]*SmgpSubmitReqPkt, error) v0 v0.0.5 Nov 11, 2021 v0.0.4 Sep 7, 2021 v0.0.3 Aug 20, 2021 Changes in this version + const SmgpQueryReqPktLen + const SmgpQueryRespPktLen + type SmgpQueryReqPkt struct + QueryCode string + QueryTime string + QueryType uint8 + SequenceID uint32 + func (p *SmgpQueryReqPkt) Pack(seqId uint32) ([]byte, error) + func (p *SmgpQueryReqPkt) String() string + func (p *SmgpQueryReqPkt) Unpack(data []byte) error + type SmgpQueryRespPkt struct + MO_FL uint32 + MO_Scs uint32 + MO_WT uint32 + MT_FL uint32 + MT_Scs uint32 + MT_TLMsg uint32 + MT_Tlusr uint32 + MT_WT uint32 + QueryCode string + QueryTime string + QueryType uint8 + Reserve string + SequenceID uint32 + func (p *SmgpQueryRespPkt) Pack(seqId uint32) ([]byte, error) + func (p *SmgpQueryRespPkt) String() string + func (p *SmgpQueryRespPkt) Unpack(data []byte) error v0.0.2 Aug 20, 2021 v0.0.1 Aug 19, 2021 Changes in this version + func GenAuthenticatorServer(status Status, secret, AuthenticatorClient string) ([]byte, error) v0.0.0 Aug 16, 2021 Changes in this version + const ASCII + const BINARY + const GB18030 + const HIGHER_PRIORITY + const HIGHEST_PRIORITY + const HeaderPktLen + const IS_REPORT + const LOW_PRIORITY + const MO + const MT + const NEED_REPORT + const NORMAL_PRIORITY + const NOT_REPORT + const NO_NEED_REPORT + const RECEIVE_MODE + const SEND_MODE + const SMGP_HEADER_LEN + const SMGP_PACKET_MAX + const SMGP_PACKET_MIN + const SmgpActiveTestReqPktLen + const SmgpActiveTestRespPktLen + const SmgpDeliverRespPktLen + const SmgpExitReqPktLen + const SmgpExitRespPktLen + const SmgpLoginReqPktLen + const SmgpLoginRespPktLen + const SmgpSubmitRespPktLen + const TRANSMIT_MODE + const UCS2 + const VERSION + var ErrConnIsClosed = errors.New("connection is closed") + var ErrLength = errors.New("Options: error length") + var ErrMethodParamsInvalid = errors.New("params passed to method is invalid") + var ErrReadHeaderTimeout = errors.New("read header timeout") + var ErrReadPktBodyTimeout = errors.New("read packet body timeout") + var ErrRequestIDInvalid = errors.New("RequestID in Packet data is invalid") + var ErrRequestIDNotSupported = errors.New("RequestID in Packet data is not supported") + var ErrTotalLengthInvalid = errors.New("PacketLength in Packet data is invalid") + var TagName = map[Tag]string + var TpUdhiSeq byte = 0x00 + func GB18030ToUtf8(in string) (string, error) + func GenAuthenticatorClient(clientId, secret string, timestamp uint32) ([]byte, error) + func GenMsgID(spId string, sequenceNum uint32) (string, error) + func GenNowTimeYYStr() string + func GenNowTimeYYYYStr() string + func GenTimestamp() uint32 + func SplitLongSms(content string) [][]byte + func Ucs2ToUtf8(in string) (string, error) + func UnpackMsgId(msgId string) string + func Utf8ToGB18030(in string) (string, error) + func Utf8ToUcs2(in string) (string, error) + type Conn struct + SequenceID <-chan uint32 + SequenceNum <-chan uint32 + State State + Version uint8 + func NewConnection(conn net.Conn, v uint8) *Conn + func (c *Conn) Close() + func (c *Conn) RecvAndUnpackPkt(timeout time.Duration) (Packer, error) + func (c *Conn) SendPkt(packet Packer, seqId uint32) error + func (c *Conn) SetState(state State) + type Header struct + PacketLength uint32 + RequestID uint32 + SequenceID uint32 + func (p *Header) Pack(w *pkgWriter, pktLen, requestId, seqId uint32) *pkgWriter + func (p *Header) String() string + func (p *Header) Unpack(r *pkgReader) *Header + type OctetString string + func NewOctetString(o string) OctetString + func (o OctetString) Byte(fixedLength int) []byte + func (o OctetString) FixedString(fixedLength int) string + func (o OctetString) String(fixedLength int) string + type OpError struct + func NewOpError(e error, op string) *OpError + func (e *OpError) Cause() error + func (e *OpError) Error() string + func (e *OpError) Op() string + type Options map[Tag]*TLV + func ParseOptions(rawData []byte) (Options, error) + func (o Options) Len() int + func (o Options) String() string + type Packer interface + Pack func(seqId uint32) ([]byte, error) + String func() string + Unpack func(data []byte) error + type RequestID uint32 + const SMGP_ACTIVE_TEST + const SMGP_ACTIVE_TEST_RESP + const SMGP_DELIVER + const SMGP_DELIVER_RESP + const SMGP_EXIT + const SMGP_EXIT_RESP + const SMGP_FORWARD + const SMGP_FORWARD_RESP + const SMGP_GET_ALL_SP_ROUTE + const SMGP_GET_ALL_SP_ROUTE_RESP + const SMGP_GET_ALL_TE_ROUTE + const SMGP_GET_ALL_TE_ROUTE_RESP + const SMGP_LOGIN + const SMGP_LOGIN_RESP + const SMGP_PAYMENT_AFFIRM + const SMGP_PAYMENT_AFFIRM_RESP + const SMGP_PAYMENT_REQUEST + const SMGP_PAYMENT_REQUEST_RESP + const SMGP_PUSH_UPDATE_SP_ROUTE + const SMGP_PUSH_UPDATE_SP_ROUTE_RESP + const SMGP_PUSH_UPDATE_TE_ROUTE + const SMGP_PUSH_UPDATE_TE_ROUTE_RESP + const SMGP_QUERY + const SMGP_QUERY_RESP + const SMGP_QUERY_SP_ROUTE + const SMGP_QUERY_SP_ROUTE_RESP + const SMGP_QUERY_TE_ROUTE + const SMGP_QUERY_TE_ROUTE_RESP + const SMGP_QUERY_USERSTATE + const SMGP_QUERY_USERSTATE_RESP + const SMGP_REQUEST_MAX + const SMGP_REQUEST_MIN + const SMGP_RESPONSE_MAX + const SMGP_RESPONSE_MIN + const SMGP_SUBMIT + const SMGP_SUBMIT_RESP + const SMGP_UPDATE_SP_ROUTE + const SMGP_UPDATE_SP_ROUTE_RESP + const SMGP_UPDATE_TE_ROUTE + const SMGP_UPDATE_TE_ROUTE_RESP + func (id RequestID) String() string + type SmgpActiveTestReqPkt struct + SequenceID uint32 + func (p *SmgpActiveTestReqPkt) Pack(seqId uint32) ([]byte, error) + func (p *SmgpActiveTestReqPkt) String() string + func (p *SmgpActiveTestReqPkt) Unpack(data []byte) error + type SmgpActiveTestRespPkt struct + SequenceID uint32 + func (p *SmgpActiveTestRespPkt) Pack(seqId uint32) ([]byte, error) + func (p *SmgpActiveTestRespPkt) String() string + func (p *SmgpActiveTestRespPkt) Unpack(data []byte) error + type SmgpDeliverMsgContent struct + Dlvrd string + DoneDate string + Err string + Stat string + Sub string + SubmitDate string + SubmitMsgID string + Txt string + func DecodeDeliverMsgContent(data []byte) *SmgpDeliverMsgContent + func (p *SmgpDeliverMsgContent) Encode() string + func (p *SmgpDeliverMsgContent) String() string + type SmgpDeliverReqPkt struct + DestTermID string + IsReport uint8 + MsgContent []byte + MsgFormat uint8 + MsgID string + MsgLength uint8 + MsgStatContent *SmgpDeliverMsgContent + Options Options + RecvTime string + Reserve string + SequenceID uint32 + SrcTermID string + func (p *SmgpDeliverReqPkt) Pack(seqId uint32) ([]byte, error) + func (p *SmgpDeliverReqPkt) String() string + func (p *SmgpDeliverReqPkt) Unpack(data []byte) error + type SmgpDeliverRespPkt struct + MsgID string + SequenceID uint32 + Status Status + func (p *SmgpDeliverRespPkt) Pack(seqId uint32) ([]byte, error) + func (p *SmgpDeliverRespPkt) String() string + func (p *SmgpDeliverRespPkt) Unpack(data []byte) error + type SmgpExitReqPkt struct + SequenceID uint32 + func (p *SmgpExitReqPkt) Pack(seqId uint32) ([]byte, error) + func (p *SmgpExitReqPkt) String() string + func (p *SmgpExitReqPkt) Unpack(data []byte) error + type SmgpExitRespPkt struct + SequenceID uint32 + func (p *SmgpExitRespPkt) Pack(seqId uint32) ([]byte, error) + func (p *SmgpExitRespPkt) String() string + func (p *SmgpExitRespPkt) Unpack(data []byte) error + type SmgpLoginReqPkt struct + AuthenticatorClient string + ClientID string + ClientVersion uint8 + LoginMode uint8 + Secret string + SequenceID uint32 + TimeStamp uint32 + func (p *SmgpLoginReqPkt) Pack(seqId uint32) ([]byte, error) + func (p *SmgpLoginReqPkt) String() string + func (p *SmgpLoginReqPkt) Unpack(data []byte) error + type SmgpLoginRespPkt struct + AuthenticatorClient string + AuthenticatorServer string + Secret string + SequenceID uint32 + ServerVersion uint8 + Status Status + func (p *SmgpLoginRespPkt) Pack(seqId uint32) ([]byte, error) + func (p *SmgpLoginRespPkt) String() string + func (p *SmgpLoginRespPkt) Unpack(data []byte) error + type SmgpSubmitReqPkt struct + AtTime string + ChargeTermID string + DestTermID []string + DestTermIDCount uint8 + FeeCode string + FeeType string + FixedFee string + MsgContent string + MsgFormat uint8 + MsgLength uint8 + MsgType uint8 + NeedReport uint8 + Options Options + Priority uint8 + Reserve string + SequenceID uint32 + ServiceID string + SrcTermID string + ValidTime string + func GetLongMsgPkgs(pkg *SmgpSubmitReqPkt) ([]*SmgpSubmitReqPkt, error) + func (p *SmgpSubmitReqPkt) Pack(seqId uint32) ([]byte, error) + func (p *SmgpSubmitReqPkt) String() string + func (p *SmgpSubmitReqPkt) Unpack(data []byte) error + type SmgpSubmitRespPkt struct + MsgID string + SequenceID uint32 + Status Status + func (p *SmgpSubmitRespPkt) Pack(seqId uint32) ([]byte, error) + func (p *SmgpSubmitRespPkt) String() string + func (p *SmgpSubmitRespPkt) Unpack(data []byte) error + type State uint8 + const CONNECTION_AUTHOK + const CONNECTION_CLOSED + const CONNECTION_CONNECTED + type Status uint32 + const STAT_OK + func (s *Status) Data() uint32 + func (s *Status) Error() error + func (s Status) String() string + type TLV struct + Length uint16 + Tag Tag + Value []byte + func NewTLV(tag Tag, value []byte) *TLV + func (t *TLV) Byte() ([]byte, error) + func (t *TLV) String() string + type Tag uint16 + const TAG_ChargeTermPseudo + const TAG_ChargeTermType + const TAG_ChargeUserType + const TAG_DestTermPseudo + const TAG_DestTermType + const TAG_LinkID + const TAG_MServiceID + const TAG_MsgSrc + const TAG_NodesCount + const TAG_PkNumber + const TAG_PkTotal + const TAG_SPDealResult + const TAG_SrcTermPseudo + const TAG_SrcTermType + const TAG_SrcType + const TAG_SubmitMsgType + const TAG_TP_pid + const TAG_TP_udhi