Documentation ¶
Index ¶
- Constants
- func AddPackHead(bmtl *translayer.BMTransLayer, appendData []byte) ([]byte, error)
- func GetNowMsTime() int64
- func NewHeadBuf() []byte
- func PackLongBytes(data []byte) ([]byte, error)
- func PackLongString(s string) ([]byte, error)
- func PackLongStringArray(arrs []string) ([]byte, error)
- func PackShortBytes(data []byte) ([]byte, error)
- func PackShortBytesArray(arrs [][]byte) ([]byte, error)
- func PackShortString(s string) ([]byte, error)
- func PackShortStringArray(arrs []string) ([]byte, error)
- func RegAesDecrypt(dec func(cipherText, key []byte) (iv []byte, plainBytes []byte))
- func RegAesEncrypt(enc func(plainBytes, iv, key []byte) []byte)
- func UnPackLongBytes(data []byte) ([]byte, int, error)
- func UnPackLongString(data []byte) (string, int, error)
- func UnPackLongStringArray(data []byte) ([]string, int, error)
- func UnPackShortBytes(data []byte) ([]byte, int, error)
- func UnPackShortBytesArray(data []byte) ([][]byte, int, error)
- func UnPackShortString(data []byte) (string, int, error)
- func UnPackShortStringArray(data []byte) ([]string, int, error)
- type Attachment
- type BMHello
- type BMHelloACK
- type BMailAddrss
- type BPOPDelete
- type BPOPDeleteResp
- type BPOPList
- type BPOPListResp
- type BPOPRetr
- type BPOPRetrResp
- type BPOPStat
- type BPOPStatResp
- type Cell
- type ConfirmEnvelope
- type ContactAdd
- type ContactAddResp
- type ContactDel
- type ContactDelResp
- type ContactHello
- type ContactHelloResp
- type ContactPull
- type ContactPullResp
- type CryptContactAdd
- func (cca *CryptContactAdd) Pack() ([]byte, error)
- func (cca *CryptContactAdd) SetCipherTxt(ct []byte)
- func (cca *CryptContactAdd) SetIV(iv IV)
- func (cca *CryptContactAdd) SetServerSn(sn SN)
- func (cca *CryptContactAdd) SetSigServerSn(sig []byte)
- func (cca *CryptContactAdd) UnPack(data []byte) (int, error)
- type CryptContactAddResp
- type CryptContactDel
- type CryptContactDelResp
- type CryptContactHello
- type CryptContactPull
- type CryptContactPullResp
- type CryptEnvelope
- type DelSection
- type DelSectionResult
- type Envelope
- type EnvelopeContent
- type EnvelopeCryptDesc
- type EnvelopeRoute
- type EnvelopeSig
- type FileProperty
- type Gid
- type GroupDesc
- type IV
- type ListNode
- type RespSendAttachment
- type RespSendCryptEnvelope
- type RespSendEnvelope
- type SAReader
- type SN
- type SendAttachment
- type SendCryptEnvelope
- type SendEnvelope
Constants ¶
const ( PullMail int = iota + 1 PullGroup )
const ( PeerUnreachable int = iota + 1 )
const ( ErrMsg_PeerUnreachable string = "Peer is unreachable" )
Variables ¶
This section is empty.
Functions ¶
func AddPackHead ¶
func AddPackHead(bmtl *translayer.BMTransLayer, appendData []byte) ([]byte, error)
func GetNowMsTime ¶
func GetNowMsTime() int64
func NewHeadBuf ¶
func NewHeadBuf() []byte
func PackLongBytes ¶
func PackLongString ¶
func PackLongStringArray ¶
func PackShortBytes ¶
func PackShortBytesArray ¶
func PackShortString ¶
func PackShortStringArray ¶
func RegAesDecrypt ¶
func RegAesEncrypt ¶
Types ¶
type Attachment ¶
type Attachment struct { Path string //if less 30MB, path is none, FileProperty }
func (*Attachment) Pack ¶
func (a *Attachment) Pack() ([]byte, error)
func (*Attachment) String ¶
func (a *Attachment) String() string
type BMHello ¶
type BMHello struct {
translayer.BMTransLayer
}
func NewBMHello ¶
func NewBMHello() *BMHello
type BMHelloACK ¶
type BMHelloACK struct { translayer.BMTransLayer // contains filtered or unexported fields }
func NewBMHelloACK ¶
func NewBMHelloACK(sn []byte) *BMHelloACK
func (*BMHelloACK) GetSn ¶
func (bmha *BMHelloACK) GetSn() []byte
func (*BMHelloACK) Pack ¶
func (bmha *BMHelloACK) Pack() ([]byte, error)
func (*BMHelloACK) String ¶
func (bmha *BMHelloACK) String() string
type BMailAddrss ¶
func (*BMailAddrss) Pack ¶
func (bma *BMailAddrss) Pack() ([]byte, error)
type BPOPDelete ¶
type BPOPDelete struct { translayer.BMTransLayer Section []DelSection Sn []byte Sig []byte }
func NewBPOPDelete ¶
func NewBPOPDelete() *BPOPDelete
func (*BPOPDelete) Pack ¶
func (bd *BPOPDelete) Pack() ([]byte, error)
func (*BPOPDelete) String ¶
func (bd *BPOPDelete) String() string
type BPOPDeleteResp ¶
type BPOPDeleteResp struct { translayer.BMTransLayer Result []DelSectionResult Sn []byte }
func NewBPOPDeleteResp ¶
func NewBPOPDeleteResp() *BPOPDeleteResp
func (*BPOPDeleteResp) Pack ¶
func (bd *BPOPDeleteResp) Pack() ([]byte, error)
func (*BPOPDeleteResp) String ¶
func (br *BPOPDeleteResp) String() string
type BPOPList ¶
type BPOPList struct { translayer.BMTransLayer BeginID int ListCount int }
func NewBPOPList ¶
func NewBPOPList() *BPOPList
type BPOPListResp ¶
type BPOPListResp struct { translayer.BMTransLayer BeginID int ListCount int Nodes []*ListNode }
func NewBPOPListResp ¶
func NewBPOPListResp() *BPOPListResp
func (*BPOPListResp) Pack ¶
func (bl *BPOPListResp) Pack() ([]byte, error)
func (*BPOPListResp) String ¶
func (bl *BPOPListResp) String() string
type BPOPRetr ¶
type BPOPRetr struct { translayer.BMTransLayer BeginID int RetrCount int }
func NewBPOPRetr ¶
func NewBPOPRetr() *BPOPRetr
type BPOPRetrResp ¶
type BPOPRetrResp struct { translayer.BMTransLayer Mails []CryptEnvelope BeginID int RetrCount int TotalCount int }
func NewBPOPRetrResp ¶
func NewBPOPRetrResp() *BPOPRetrResp
func (*BPOPRetrResp) Pack ¶
func (br *BPOPRetrResp) Pack() ([]byte, error)
func (*BPOPRetrResp) String ¶
func (br *BPOPRetrResp) String() string
type BPOPStat ¶
type BPOPStat struct {
translayer.BMTransLayer
}
func NewBPOPStat ¶
func NewBPOPStat() *BPOPStat
type BPOPStatResp ¶
type BPOPStatResp struct { translayer.BMTransLayer Total int Received int TotalStoredBytes int64 TotalSpaceBytes int64 }
func NewBPOPStatResp ¶
func NewBPOPStatResp() *BPOPStatResp
func (*BPOPStatResp) Pack ¶
func (br *BPOPStatResp) Pack() ([]byte, error)
func (*BPOPStatResp) String ¶
func (bs *BPOPStatResp) String() string
type ConfirmEnvelope ¶
type ConfirmEnvelope struct { Sn []byte NewSn []byte EId translayer.EnveUniqID CxtHashSig []byte ErrId int }
func (*ConfirmEnvelope) Pack ¶
func (ce *ConfirmEnvelope) Pack() ([]byte, error)
func (*ConfirmEnvelope) String ¶
func (ce *ConfirmEnvelope) String() string
type ContactAdd ¶
type ContactAdd struct {
// contains filtered or unexported fields
}
client remote add===>IV,sig{sn(from server)},sn(from server),cipher text{mail list,group list} ==>server
func (*ContactAdd) Pack ¶
func (ca *ContactAdd) Pack() ([]byte, error)
type ContactAddResp ¶
type ContactAddResp struct {
// contains filtered or unexported fields
}
server response remote add ===> IV,cipher text{sn(old),sn(new from server)},error code===>client
func (*ContactAddResp) Pack ¶
func (car *ContactAddResp) Pack() ([]byte, error)
type ContactDel ¶
type ContactDel struct {
// contains filtered or unexported fields
}
client remote del===>sig{sn},IV,cipher text{mail list,group list} ==>server
type ContactDelResp ¶
type ContactDelResp struct {
// contains filtered or unexported fields
}
server response remote del ===> IV,cipher text{sn(old),sn(new from server)},error code===client
type ContactHello ¶
type ContactHello struct { SelfMA string // contains filtered or unexported fields }
func NewContactHello ¶
func NewContactHello() *ContactHello
func (*ContactHello) GetSn ¶
func (mabh *ContactHello) GetSn() SN
func (*ContactHello) Pack ¶
func (mabh *ContactHello) Pack() ([]byte, error)
func (*ContactHello) String ¶
func (mabh *ContactHello) String() string
type ContactHelloResp ¶
type ContactHelloResp struct { translayer.BMTransLayer // contains filtered or unexported fields }
server response hello ===IV,sig{sn(from client)},sn(from server) ==>client
func NewContactHelloResp ¶
func NewContactHelloResp() *ContactHelloResp
func (*ContactHelloResp) GetIV ¶
func (mr *ContactHelloResp) GetIV() IV
func (*ContactHelloResp) Pack ¶
func (mr *ContactHelloResp) Pack() ([]byte, error)
func (*ContactHelloResp) SetClientSN ¶
func (mr *ContactHelloResp) SetClientSN(sn SN)
func (*ContactHelloResp) SetSigClientSn ¶
func (mr *ContactHelloResp) SetSigClientSn(sig []byte)
func (*ContactHelloResp) String ¶
func (mr *ContactHelloResp) String() string
type ContactPull ¶
type ContactPull struct {
// contains filtered or unexported fields
}
client pull mail list or group list ===>sig{sn(from server)},IV,cipher text{command(pull mail list or pull all or pull group)} ==server
type ContactPullResp ¶
type ContactPullResp struct {
// contains filtered or unexported fields
}
server response pull ===>IV,cipher text{mail list,group list,sn(old),sn(new from server)}
type CryptContactAdd ¶
type CryptContactAdd struct { translayer.BMTransLayer // contains filtered or unexported fields }
func NewCryptContactAdd ¶
func NewCryptContactAdd() *CryptContactAdd
func (*CryptContactAdd) Pack ¶
func (cca *CryptContactAdd) Pack() ([]byte, error)
func (*CryptContactAdd) SetCipherTxt ¶
func (cca *CryptContactAdd) SetCipherTxt(ct []byte)
func (*CryptContactAdd) SetIV ¶
func (cca *CryptContactAdd) SetIV(iv IV)
func (*CryptContactAdd) SetServerSn ¶
func (cca *CryptContactAdd) SetServerSn(sn SN)
func (*CryptContactAdd) SetSigServerSn ¶
func (cca *CryptContactAdd) SetSigServerSn(sig []byte)
type CryptContactAddResp ¶
type CryptContactAddResp struct { translayer.BMTransLayer // contains filtered or unexported fields }
type CryptContactDel ¶
type CryptContactDel struct {
// contains filtered or unexported fields
}
type CryptContactDelResp ¶
type CryptContactDelResp struct {
// contains filtered or unexported fields
}
type CryptContactHello ¶
type CryptContactHello struct { translayer.BMTransLayer // contains filtered or unexported fields }
client hello
func NewCryptContactHello ¶
func NewCryptContactHello() *CryptContactHello
func (*CryptContactHello) GetIV ¶
func (cm *CryptContactHello) GetIV() IV
func (*CryptContactHello) Pack ¶
func (cm *CryptContactHello) Pack() ([]byte, error)
func (*CryptContactHello) SetCipherText ¶
func (cm *CryptContactHello) SetCipherText(ct []byte)
func (*CryptContactHello) String ¶
func (cm *CryptContactHello) String() string
type CryptContactPull ¶
type CryptContactPull struct { translayer.BMTransLayer // contains filtered or unexported fields }
type CryptContactPullResp ¶
type CryptContactPullResp struct {
// contains filtered or unexported fields
}
type CryptEnvelope ¶
type CryptEnvelope struct { EnvelopeSig EnvelopeRoute EnvelopeCryptDesc CipherTxt []byte }
func EncodeEnvelope ¶
func EncodeEnvelope(e *Envelope, key []byte) *CryptEnvelope
func (*CryptEnvelope) Pack ¶
func (ce *CryptEnvelope) Pack() ([]byte, error)
func (*CryptEnvelope) String ¶
func (ce *CryptEnvelope) String() string
type DelSection ¶
func (*DelSection) Pack ¶
func (ds *DelSection) Pack() ([]byte, error)
func (*DelSection) String ¶
func (ds *DelSection) String() string
type DelSectionResult ¶
type DelSectionResult struct { DelSection ErroCode int //0 success,1 failure }
func (*DelSectionResult) Pack ¶
func (dsr *DelSectionResult) Pack() ([]byte, error)
func (*DelSectionResult) String ¶
func (dsr *DelSectionResult) String() string
type Envelope ¶
type Envelope struct { EnvelopeSig EnvelopeRoute EnvelopeCryptDesc EnvelopeContent }
func DeCodeEnvelope ¶
func DeCodeEnvelope(ce *CryptEnvelope, key []byte) *Envelope
type EnvelopeContent ¶
type EnvelopeContent struct { To []string CC []string BC []string Subject string Data string Files []Attachment }
func (*EnvelopeContent) Pack ¶
func (ec *EnvelopeContent) Pack() ([]byte, error)
func (*EnvelopeContent) String ¶
func (ec *EnvelopeContent) String() string
type EnvelopeCryptDesc ¶
func (*EnvelopeCryptDesc) CopyTo ¶
func (ecd *EnvelopeCryptDesc) CopyTo(ecd1 *EnvelopeCryptDesc) *EnvelopeCryptDesc
func (*EnvelopeCryptDesc) Pack ¶
func (ecd *EnvelopeCryptDesc) Pack() ([]byte, error)
func (*EnvelopeCryptDesc) String ¶
func (ecd *EnvelopeCryptDesc) String() string
type EnvelopeRoute ¶
type EnvelopeRoute struct { From string RecpAddr string //recipient RecpAddrType int //0 to,1 cc,2 bc EId translayer.EnveUniqID //envelope unique id }
func (*EnvelopeRoute) CopyTo ¶
func (eh *EnvelopeRoute) CopyTo(to *EnvelopeRoute) *EnvelopeRoute
func (*EnvelopeRoute) Pack ¶
func (eh *EnvelopeRoute) Pack() ([]byte, error)
func (*EnvelopeRoute) String ¶
func (eh *EnvelopeRoute) String() string
type EnvelopeSig ¶
func (*EnvelopeSig) CopyTo ¶
func (es *EnvelopeSig) CopyTo(to *EnvelopeSig) *EnvelopeSig
func (*EnvelopeSig) Pack ¶
func (ee *EnvelopeSig) Pack() ([]byte, error)
func (*EnvelopeSig) String ¶
func (et *EnvelopeSig) String() string
type FileProperty ¶
func (*FileProperty) Pack ¶
func (fp *FileProperty) Pack() ([]byte, error)
func (*FileProperty) String ¶
func (fp *FileProperty) String() string
type GroupDesc ¶
type RespSendAttachment ¶
type RespSendAttachment struct { translayer.BMTransLayer FileProperty Sn []byte NewSn []byte EId translayer.EnveUniqID ErrId int }
func NewRespSendAttachment ¶
func NewRespSendAttachment() *RespSendAttachment
func (*RespSendAttachment) Pack ¶
func (rsa *RespSendAttachment) Pack() ([]byte, error)
func (*RespSendAttachment) String ¶
func (rsa *RespSendAttachment) String() string
type RespSendCryptEnvelope ¶
type RespSendCryptEnvelope struct { translayer.BMTransLayer ConfirmEnvelope }
ErrId: 0: success 1: Receipt Address not found 2: Receipt Address is forbidden 3: Data is forbidden 4: bmail command Not Found 5: Mail to large 6: Mail refused by server 7: Connect to Server failed
server -> client
func NewRespSendCryptEnvelope ¶
func NewRespSendCryptEnvelope() *RespSendCryptEnvelope
func (*RespSendCryptEnvelope) Pack ¶
func (rse *RespSendCryptEnvelope) Pack() ([]byte, error)
func (*RespSendCryptEnvelope) String ¶
func (rse *RespSendCryptEnvelope) String() string
type RespSendEnvelope ¶
type RespSendEnvelope struct { translayer.BMTransLayer ConfirmEnvelope }
server -> client
func NewRespSendEnvelope ¶
func NewRespSendEnvelope() *RespSendEnvelope
func (*RespSendEnvelope) Pack ¶
func (rse *RespSendEnvelope) Pack() ([]byte, error)
func (*RespSendEnvelope) String ¶
func (rse *RespSendEnvelope) String() string
type SAReader ¶
func (*SAReader) GetTotalSize ¶
type SendAttachment ¶
type SendAttachment struct { translayer.BMTransLayer FileProperty EnvelopeSig EId translayer.EnveUniqID File *os.File }
func NewSendAttachment ¶
func NewSendAttachment() *SendAttachment
func (*SendAttachment) GetReader ¶
func (sa *SendAttachment) GetReader() (*SAReader, error)
func (*SendAttachment) String ¶
func (sa *SendAttachment) String() string
type SendCryptEnvelope ¶
type SendCryptEnvelope struct { translayer.BMTransLayer CryptEnvelope }
client -> server
func NewSendCryptEnvelope ¶
func NewSendCryptEnvelope() *SendCryptEnvelope
func (*SendCryptEnvelope) Pack ¶
func (se *SendCryptEnvelope) Pack() ([]byte, error)
func (*SendCryptEnvelope) String ¶
func (se *SendCryptEnvelope) String() string
type SendEnvelope ¶
type SendEnvelope struct { translayer.BMTransLayer Envelope }
func NewSendEnvelope ¶
func NewSendEnvelope() *SendEnvelope
func (*SendEnvelope) Pack ¶
func (se *SendEnvelope) Pack() ([]byte, error)
func (*SendEnvelope) String ¶
func (se *SendEnvelope) String() string