github.com/status-im/status-go@v1.1.0/waku/common/const.go (about)

     1  // Copyright 2019 The Waku Library Authors.
     2  //
     3  // The Waku library is free software: you can redistribute it and/or modify
     4  // it under the terms of the GNU Lesser General Public License as published by
     5  // the Free Software Foundation, either version 3 of the License, or
     6  // (at your option) any later version.
     7  //
     8  // The Waku library is distributed in the hope that it will be useful,
     9  // but WITHOUT ANY WARRANTY; without even the implied warranty off
    10  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    11  // GNU Lesser General Public License for more details.
    12  //
    13  // You should have received a copy of the GNU Lesser General Public License
    14  // along with the Waku library. If not, see <http://www.gnu.org/licenses/>.
    15  //
    16  // This software uses the go-ethereum library, which is licensed
    17  // under the GNU Lesser General Public Library, version 3 or any later.
    18  
    19  package common
    20  
    21  import (
    22  	"time"
    23  
    24  	"github.com/ethereum/go-ethereum/crypto"
    25  )
    26  
    27  // Waku protocol parameters
    28  const (
    29  	SizeMask      = byte(3) // mask used to extract the size of payload size field from the flags
    30  	signatureFlag = byte(4)
    31  
    32  	TopicLength      = 4                      // in bytes
    33  	signatureLength  = crypto.SignatureLength // in bytes
    34  	AESKeyLength     = 32                     // in bytes
    35  	aesNonceLength   = 12                     // in bytes; for more info please see cipher.gcmStandardNonceSize & aesgcm.NonceSize()
    36  	KeyIDSize        = 32                     // in bytes
    37  	BloomFilterSize  = 64                     // in bytes
    38  	MaxTopicInterest = 10000
    39  	flagsLength      = 1
    40  
    41  	EnvelopeHeaderLength = 20
    42  
    43  	MaxMessageSize        = uint32(10 * 1024 * 1024) // maximum accepted size of a message.
    44  	DefaultMaxMessageSize = uint32(1024 * 1024)
    45  	DefaultMinimumPoW     = 0.2
    46  
    47  	padSizeLimit = 256 // just an arbitrary number, could be changed without breaking the protocol
    48  
    49  	ExpirationCycle   = time.Second
    50  	TransmissionCycle = 300 * time.Millisecond
    51  
    52  	DefaultTTL           = 50 // seconds
    53  	DefaultSyncAllowance = 10 // seconds
    54  
    55  	MaxLimitInSyncMailRequest = 1000
    56  
    57  	EnvelopeTimeNotSynced uint = iota + 1
    58  	EnvelopeOtherError
    59  
    60  	MaxLimitInMessagesRequest = 1000
    61  )