github.com/linapex/ethereum-dpos-chinese@v0.0.0-20190316121959-b78b3a4a1ece/whisper/whisperv5/doc.go (about)

     1  
     2  //<developer>
     3  //    <name>linapex 曹一峰</name>
     4  //    <email>linapex@163.com</email>
     5  //    <wx>superexc</wx>
     6  //    <qqgroup>128148617</qqgroup>
     7  //    <url>https://jsq.ink</url>
     8  //    <role>pku engineer</role>
     9  //    <date>2019-03-16 12:09:51</date>
    10  //</624342688509988864>
    11  
    12  //
    13  //
    14  //
    15  //
    16  //
    17  //
    18  //
    19  //
    20  //
    21  //
    22  //
    23  //
    24  //
    25  //
    26  //
    27  
    28  /*
    29  
    30  
    31  
    32  
    33  
    34  
    35  
    36  
    37  
    38  
    39  
    40  */
    41  
    42  package whisperv5
    43  
    44  import (
    45  	"fmt"
    46  	"time"
    47  )
    48  
    49  const (
    50  	EnvelopeVersion    = uint64(0)
    51  	ProtocolVersion    = uint64(5)
    52  	ProtocolVersionStr = "5.0"
    53  	ProtocolName       = "shh"
    54  
    55  statusCode           = 0 //
    56  messagesCode         = 1 //
    57  p2pCode              = 2 //
    58  p2pRequestCode       = 3 //
    59  	NumberOfMessageCodes = 64
    60  
    61  	paddingMask   = byte(3)
    62  	signatureFlag = byte(4)
    63  
    64  	TopicLength     = 4
    65  	signatureLength = 65
    66  	aesKeyLength    = 32
    67  	AESNonceLength  = 12
    68  	keyIdSize       = 32
    69  
    70  MaxMessageSize        = uint32(10 * 1024 * 1024) //
    71  	DefaultMaxMessageSize = uint32(1024 * 1024)
    72  	DefaultMinimumPoW     = 0.2
    73  
    74  padSizeLimit      = 256 //
    75  	messageQueueLimit = 1024
    76  
    77  	expirationCycle   = time.Second
    78  	transmissionCycle = 300 * time.Millisecond
    79  
    80  DefaultTTL     = 50 //
    81  SynchAllowance = 10 //
    82  )
    83  
    84  type unknownVersionError uint64
    85  
    86  func (e unknownVersionError) Error() string {
    87  	return fmt.Sprintf("invalid envelope version %d", uint64(e))
    88  }
    89  
    90  //
    91  //
    92  //
    93  //
    94  //
    95  //
    96  type MailServer interface {
    97  	Archive(env *Envelope)
    98  	DeliverMail(whisperPeer *Peer, request *Envelope)
    99  }
   100