package pb const ( V1 = "1.0" ) func Msg(typ Message_Type, ok bool, data []byte) *Message { return &Message{ Type: typ, Version: V1, Payload: &Pack{ Ok: ok, Data: data, }, } } func (m *Message) IsIbtpRouter() bool { return m.Type == Message_IBTP_SEND || m.Type == Message_IBTP_GET || m.Type == Message_IBTP_RECEIPT_SEND || m.Type == Message_IBTP_RECEIPT_GET } func (m *Message) IsLocalMsg() bool { return m.Type == Message_APPCHAIN_GET || m.Type == Message_RULE_DEPLOY || m.Type == Message_APPCHAIN_REGISTER || m.Type == Message_APPCHAIN_UPDATE } func (m *Message) GetIBTPX() (*IBTPX, error) { ibtpx := &IBTPX{} err := ibtpx.Unmarshal(m.Payload.Data) return ibtpx, err }