protocol

package
v0.0.0-...-8071ca5 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2020 License: GPL-2.0 Imports: 3 Imported by: 6

Documentation

Index

Constants

View Source
const (
	AddFriend int = iota
	DelFriend
	ListFriendSummary
	ListGroupSummary
	ListFriend
	AddGroup
	DelGroup
	ChgGroup
	ListGroupMbr
	StoreGrpKeys
	FetchGrpKeys
	StoreP2pMsg
	FetchP2pMsg
	StoreGMsg
	FetchGMsg
	JoinGroup
	QuitGroup
)
View Source
const (
	UserExpired int = iota + 1
	PeerExpired
	PeerNotExisted
	UserNotFound
	InternalError
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FriendAddInfo

type FriendAddInfo struct {
	Addr      address.ChatAddress `json:"addr"`
	AliasName string              `json:"alias_name"`
	AddTime   int64               `json:"add_time"`
	Agree     int                 `json:"agree"`
}

type FriendAddResp

type FriendAddResp struct {
	Op         int           `json:"op"`
	ResultCode int           `json:"result_code"`
	FAI        FriendAddInfo `json:"fd"`
}

type FriendDesc

type FriendDesc struct {
	PeerPubKey string `json:"peer_pub_key"`
	SendTime   int64  `json:"send_time"`
}

type FriendDetails

type FriendDetails struct {
	Alias      string `json:"alias"`
	PubKey     string `json:"pub_key"`
	ExpireTime int64  `json:"expire_time"`
	AddTime    int64  `json:"add_time"`
	Agree      int    `json:"agree"` //1 true and false, 0 not sure ,2 false and true, 3 true true
}

type FriendList

type FriendList struct {
	UpdateTime int64           `json:"update_time"`
	FD         []FriendDetails `json:"fd"`
	GD         []GroupDetails  `json:"gd"`
}

type FriendReq

type FriendReq struct {
	Op int        `json:"op"`
	SP SignPack   `json:"sp"`
	FD FriendDesc `json:"fd"`
}

type FriendSummary

type FriendSummary struct {
	FriendUpdateTime int64 `json:"fut"`
}

type GMember

type GMember struct {
	Alias      string `json:"alias"`
	PubKey     string `json:"pub_key"`
	ExpireTime int64  `json:"expire_time"`
	Agree      int    `json:"agree"` //1 true and false, 0 not sure ,2 false and true, 3 true true
}

type GMsgFetch

type GMsgFetch struct {
	Gid   groupid.GrpID `json:"gid"`
	Begin int           `json:"begin"`
	Count int           `json:"count"`
}

type GMsgFetchContent

type GMsgFetchContent struct {
	Gid groupid.GrpID `json:"gid"`
	LM  []LGroupMsg   `json:"lm"`
}

type GMsgFetchReq

type GMsgFetchReq struct {
	Op   int       `json:"op"`
	SP   SignPack  `json:"sp"`
	GMsg GMsgFetch `json:"gmsg"`
}

type GMsgFetchResp

type GMsgFetchResp struct {
	Op         int              `json:"op"`
	ResultCode int              `json:"result_code"`
	GMsg       GMsgFetchContent `json:"gmsg"`
}

type GroupCreateInfo

type GroupCreateInfo struct {
	GroupName  string        `json:"group_name"`
	GID        groupid.GrpID `json:"gid"`
	IsOwner    bool          `json:"is_owner"`
	CreateTime int64         `json:"create_time"`
}

type GroupDesc

type GroupDesc struct {
	GroupAlias string `json:"group_name"`
	GroupID    string `json:"group_id"`
	SendTime   int64  `json:"send_time"`
}

type GroupDetails

type GroupDetails struct {
	Alias      string `json:"alias"`
	IsOwner    bool   `json:"is_owner"`
	CreateTime int64  `json:"create_time"`
	GrpId      string `json:"grp_id"`
	MembrsCnt  int    `json:"membrs_cnt"`
}

type GroupKeyFetchReq

type GroupKeyFetchReq struct {
	Op  int           `json:"op"`
	SP  SignPack      `json:"sp"`
	GKI GroupKeyIndex `json:"gki"`
}

type GroupKeyFetchResp

type GroupKeyFetchResp struct {
	Op  int       `json:"op"`
	SP  SignPack  `json:"sp"`
	GKs GroupKeys `json:"gks"`
}

type GroupKeyIndex

type GroupKeyIndex struct {
	IndexKey string `json:"index_key"`
}

type GroupKeyStoreReq

type GroupKeyStoreReq struct {
	Op  int       `json:"op"`
	SP  SignPack  `json:"sp"`
	GKs GroupKeys `json:"gks"`
}

type GroupKeyStoreResp

type GroupKeyStoreResp struct {
	Op         int           `json:"op"`
	ResultCode int           `json:"result_code"`
	GKI        GroupKeyIndex `json:"gki"`
}

type GroupKeys

type GroupKeys struct {
	GroupKeys []string `json:"group_keys"`
	PubKeys   []string `json:"pub_keys"`
}

type GroupMbrAddInfo

type GroupMbrAddInfo struct {
	GID        groupid.GrpID       `json:"gid"`
	FriendName string              `json:"friend_name"`
	FriendAddr address.ChatAddress `json:"friend_addr"`
	Agree      int                 `json:"agree"`
	JoinTime   int64               `json:"join_time"`
	GKeyHash   string              `json:"g_key_hash"`
}

type GroupMbrDetailsList

type GroupMbrDetailsList struct {
	Owner string    `json:"owner"`
	Gkeys []string  `json:"gkeys"`
	PKeys []string  `json:"pkeys"`
	Hashk string    `json:"hashk"`
	FD    []GMember `json:"fd"`
}

type GroupMemberDesc

type GroupMemberDesc struct {
	GroupID  string   `json:"group_id"`
	Friend   string   `json:"friend"`
	SendTime int64    `json:"send_time"`
	Pubkeys  []string `json:"pubkeys"`
	GKeys    []string `json:"g_keys"`
}

type GroupMemberReq

type GroupMemberReq struct {
	Op  int             `json:"op"`
	SP  SignPack        `json:"sp"`
	GMD GroupMemberDesc `json:"gmd"`
}

type GroupMemberResp

type GroupMemberResp struct {
	Op         int             `json:"op"`
	ResultCode int             `json:"result_code"`
	GMAI       GroupMbrAddInfo `json:"gmd"`
}

type GroupModTime

type GroupModTime struct {
	GroupId         groupid.GrpID `json:"gid"`
	GroupUpdate     int64         `json:"gu"`
	GrpMemberUpdate int64         `json:"gmu"`
}

type GroupMsg

type GroupMsg struct {
	Gid groupid.GrpID `json:"gid"`
	//Speek   address.ChatAddress `json:"speek"`
	AesHash string `json:"aes"`
	Msg     string `json:"msg"`
}

type GroupMsgStoreReq

type GroupMsgStoreReq struct {
	Op   int      `json:"op"`
	SP   SignPack `json:"sp"`
	GMsg GroupMsg `json:"gmsg"`
}

type GroupMsgStoreResp

type GroupMsgStoreResp struct {
	Op         int `json:"op"`
	ResultCode int `json:"result_code"`
}

type GroupReq

type GroupReq struct {
	Op int       `json:"op"`
	SP SignPack  `json:"sp"`
	GD GroupDesc `json:"gd"`
}

type GroupResp

type GroupResp struct {
	Op         int             `json:"op"`
	ResultCode int             `json:"result_code"`
	GCI        GroupCreateInfo `json:"gd"`
}

type GroupSummary

type GroupSummary struct {
	GroupId []groupid.GrpID `json:"gids"`
}

type GroupSummaryResult

type GroupSummaryResult struct {
	GMT []GroupModTime `json:"gmt"`
}

type LGroupMsg

type LGroupMsg struct {
	AesHash string              `json:"aes"`
	Msg     string              `json:"msg"`
	Speek   address.ChatAddress `json:"speek"`
	Cnt     int                 `json:"cnt"`
	UCnt    int                 `json:"u_cnt"`
}

type LP2pMsg

type LP2pMsg struct {
	PubKey string `json:"ppk"`
	Msg    string `json:"msg"`
	Cnt    int    `json:"cnt"`
}

type ListFriendReq

type ListFriendReq struct {
	Op int      `json:"op"`
	SP SignPack `json:"sp"`
}

type ListFriendResp

type ListFriendResp struct {
	Op int        `json:"op"`
	SP SignPack   `json:"sp"`
	FL FriendList `json:"fl"`
}

type ListFriendSummaryReq

type ListFriendSummaryReq struct {
	Op int      `json:"op"`
	SP SignPack `json:"sp"`
}

type ListFriendSummaryResp

type ListFriendSummaryResp struct {
	Op         int           `json:"op"`
	ResultCode int           `json:"result_code"`
	FS         FriendSummary `json:"fs"`
}

type ListGroupMbrsReq

type ListGroupMbrsReq struct {
	Op int        `json:"op"`
	SP SignPack   `json:"sp"`
	LG ListGrpMbr `json:"lg"`
}

type ListGroupSummaryReq

type ListGroupSummaryReq struct {
	Op int          `json:"op"`
	SP SignPack     `json:"sp"`
	GS GroupSummary `json:"gs"`
}

type ListGroupSummaryResp

type ListGroupSummaryResp struct {
	Op         int                `json:"op"`
	ResultCode int                `json:"result_code"`
	GSR        GroupSummaryResult `json:"gsr"`
}

type ListGrpMbr

type ListGrpMbr struct {
	GroupId string `json:"group_id"`
}

type ListGrpMbrsResp

type ListGrpMbrsResp struct {
	Op         int                 `json:"op"`
	ResultCode int                 `json:"result_code"`
	GML        GroupMbrDetailsList `json:"gml"`
}

type P2pMsg

type P2pMsg struct {
	PeerPk string `json:"ppk"`
	MyPk   string `json:"mpk"`
	Msg    string `json:"msg"`
}

type P2pMsgFetch

type P2pMsgFetch struct {
	Begin  int    `json:"begin"`
	Count  int    `json:"count"`
	PeerPk string `json:"peer_pk"`
}

type P2pMsgFetchReq

type P2pMsgFetchReq struct {
	Op  int         `json:"op"`
	SP  SignPack    `json:"sp"`
	Msg P2pMsgFetch `json:"msg"`
}

type P2pMsgFetchResp

type P2pMsgFetchResp struct {
	Op         int       `json:"op"`
	ResultCode int       `json:"result_code"`
	Msg        []LP2pMsg `json:"msg"`
}

type P2pMsgStoreReq

type P2pMsgStoreReq struct {
	Op  int      `json:"op"`
	SP  SignPack `json:"sp"`
	Msg P2pMsg   `json:"msg"`
}

type P2pMsgStoreResp

type P2pMsgStoreResp struct {
	Op         int `json:"op"`
	ResultCode int `json:"result_code"`
}

type SignPack

type SignPack struct {
	Sign     string       `json:"sign"`
	SignText UserSignText `json:"sign_text"`
}

type UCReply

type UCReply struct {
	OP         int
	ResultCode int    `json:"result_code"`
	CipherTxt  string `json:"cipher_txt"`
}

type UserCommand

type UserCommand struct {
	Op        int      `json:"op"`
	SP        SignPack `json:"sp"`
	CipherTxt string   `json:"cipher_txt"`
}

func NewUserCommand

func NewUserCommand(op int) *UserCommand

type UserRegReq

type UserRegReq struct {
	AliasName    string `json:"alias_name"`
	CPubKey      string `json:"c_pub_key"`
	TimeInterval int64  `json:"time_interval"`
}

type UserRegResp

type UserRegResp struct {
	SP      SignPack `json:"sp"`
	ErrCode int      `json:"err_code"`
}

type UserSignText

type UserSignText struct {
	AliasName  string `json:"alias_name"`
	CPubKey    string `json:"c_pub_key"`
	SPubKey    string `json:"s_pub_key"`
	ExpireTime int64  `json:"expire_time"`
}

func (*UserSignText) ForSig

func (ust *UserSignText) ForSig() ([]byte, error)

Jump to

Keyboard shortcuts

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