status-im/status-go

View on GitHub
waku/common/const.go

Summary

Maintainability
A
0 mins
Test Coverage
// Copyright 2019 The Waku Library Authors.
//
// The Waku library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The Waku library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty off
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the Waku library. If not, see <http://www.gnu.org/licenses/>.
//
// This software uses the go-ethereum library, which is licensed
// under the GNU Lesser General Public Library, version 3 or any later.

package common

import (
    "time"

    "github.com/ethereum/go-ethereum/crypto"
)

// Waku protocol parameters
const (
    SizeMask      = byte(3) // mask used to extract the size of payload size field from the flags
    signatureFlag = byte(4)

    TopicLength      = 4                      // in bytes
    signatureLength  = crypto.SignatureLength // in bytes
    AESKeyLength     = 32                     // in bytes
    aesNonceLength   = 12                     // in bytes; for more info please see cipher.gcmStandardNonceSize & aesgcm.NonceSize()
    KeyIDSize        = 32                     // in bytes
    BloomFilterSize  = 64                     // in bytes
    MaxTopicInterest = 10000
    flagsLength      = 1

    EnvelopeHeaderLength = 20

    MaxMessageSize        = uint32(10 * 1024 * 1024) // maximum accepted size of a message.
    DefaultMaxMessageSize = uint32(1024 * 1024)
    DefaultMinimumPoW     = 0.2

    padSizeLimit = 256 // just an arbitrary number, could be changed without breaking the protocol

    ExpirationCycle   = time.Second
    TransmissionCycle = 300 * time.Millisecond

    DefaultTTL           = 50 // seconds
    DefaultSyncAllowance = 10 // seconds

    MaxLimitInSyncMailRequest = 1000

    EnvelopeTimeNotSynced uint = iota + 1
    EnvelopeOtherError

    MaxLimitInMessagesRequest = 1000
)