Documentation ¶
Index ¶
- Constants
- func Decrypt(msg *msg1.ChainMessage) (*msg1.ChainMessage, error)
- func Encrypt(msg *msg1.ChainMessage) (*msg1.ChainMessage, error)
- func Error(msgType string, err error) *msg1.ChainMessage
- func GetPublicKey(targetPeerId string) (*crypto.Key, error)
- func Ok(msgType string) *msg1.ChainMessage
- func ReceiveValidate(msg *msg1.ChainMessage) error
- func RegistChainMessageHandler(msgType string, ...)
- func Response(msgType string, payload interface{}) *msg1.ChainMessage
- func ResponseValidate(msg *msg1.ChainMessage) error
- func SendValidate(msg *msg1.ChainMessage) error
- func SetResponse(request *msg1.ChainMessage, response *msg1.ChainMessage)
- type ChainMessageHandler
Constants ¶
View Source
const ( PayloadType_PeerClient = "peerClient" PayloadType_PeerEndpoint = "peerEndpoint" PayloadType_ChainApp = "chainApp" PayloadType_DataBlock = "dataBlock" PayloadType_ConsensusLog = "consensusLog" PayloadType_PeerClients = "peerClients" PayloadType_PeerEndpoints = "peerEndpoints" PayloadType_ChainApps = "chainApps" PayloadType_DataBlocks = "dataBlocks" PayloadType_String = "string" PayloadType_Map = "map" )
View Source
const CompressLimit = 2048
View Source
const PayloadLimit = 32 * 1024
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
func Decrypt(msg *msg1.ChainMessage) (*msg1.ChainMessage, error)
func Encrypt ¶
func Encrypt(msg *msg1.ChainMessage) (*msg1.ChainMessage, error)
func Ok ¶
func Ok(msgType string) *msg1.ChainMessage
func RegistChainMessageHandler ¶
func RegistChainMessageHandler(msgType string, sendHandler func(chainMessage *entity.ChainMessage) (*entity.ChainMessage, error), receiveHandler func(chainMessage *entity.ChainMessage) (*entity.ChainMessage, error), responseHandler func(chainMessage *entity.ChainMessage) error)
* 注册各action的消息处理函数
func Response ¶
func Response(msgType string, payload interface{}) *msg1.ChainMessage
func SetResponse ¶
func SetResponse(request *msg1.ChainMessage, response *msg1.ChainMessage)
Types ¶
type ChainMessageHandler ¶
type ChainMessageHandler struct { MsgType string /** 接收函数,返回的整数:0,不关闭流;1,发送完处理结果后关闭写流,不能再写;2,发送完处理结果后重置流,不能读写,完全关闭 */ ReceiveHandler func(chainMessage *entity.ChainMessage) (*entity.ChainMessage, error) SendHandler func(chainMessage *entity.ChainMessage) (*entity.ChainMessage, error) ResponseHandler func(chainMessage *entity.ChainMessage) error }
func GetChainMessageHandler ¶
func GetChainMessageHandler(msgType string) (*ChainMessageHandler, error)
Click to show internal directories.
Click to hide internal directories.