feat: Waku v2 bridge

Issue #12610
This commit is contained in:
Michal Iskierko
2023-11-12 13:29:38 +01:00
parent 56e7bd01ca
commit 6d31343205
6716 changed files with 1982502 additions and 5891 deletions

View File

@@ -0,0 +1,30 @@
package peersyncing
import "errors"
type SyncMessageType int
type SyncMessage struct {
ID []byte
Type SyncMessageType
GroupID []byte
Payload []byte
Timestamp uint64
}
var ErrSyncMessageNotValid = errors.New("sync message not valid")
func (s *SyncMessage) Valid() error {
valid := len(s.ID) != 0 && s.Type != SyncMessageNoType && len(s.GroupID) != 0 && len(s.Payload) != 0 && s.Timestamp != 0
if !valid {
return ErrSyncMessageNotValid
}
return nil
}
const (
SyncMessageNoType SyncMessageType = iota
SyncMessageCommunityType
SyncMessageOneToOneType
SyncMessagePrivateGroup
)