github.com/yinchengtsinghua/golang-Eos-dpos-Ethereum@v0.0.0-20190121132951-92cc4225ed8e/whisper/whisperv5/doc.go (about) 1 2 //此源码被清华学神尹成大魔王专业翻译分析并修改 3 //尹成QQ77025077 4 //尹成微信18510341407 5 //尹成所在QQ群721929980 6 //尹成邮箱 yinc13@mails.tsinghua.edu.cn 7 //尹成毕业于清华大学,微软区块链领域全球最有价值专家 8 //https://mvp.microsoft.com/zh-cn/PublicProfile/4033620 9 // 10 // 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 package whisperv5 40 41 import ( 42 "fmt" 43 "time" 44 ) 45 46 const ( 47 EnvelopeVersion = uint64(0) 48 ProtocolVersion = uint64(5) 49 ProtocolVersionStr = "5.0" 50 ProtocolName = "shh" 51 52 statusCode = 0 // 53 messagesCode = 1 // 54 p2pCode = 2 // 55 p2pRequestCode = 3 // 56 NumberOfMessageCodes = 64 57 58 paddingMask = byte(3) 59 signatureFlag = byte(4) 60 61 TopicLength = 4 62 signatureLength = 65 63 aesKeyLength = 32 64 AESNonceLength = 12 65 keyIdSize = 32 66 67 MaxMessageSize = uint32(10 * 1024 * 1024) // 68 DefaultMaxMessageSize = uint32(1024 * 1024) 69 DefaultMinimumPoW = 0.2 70 71 padSizeLimit = 256 // 72 messageQueueLimit = 1024 73 74 expirationCycle = time.Second 75 transmissionCycle = 300 * time.Millisecond 76 77 DefaultTTL = 50 // 78 SynchAllowance = 10 // 79 ) 80 81 type unknownVersionError uint64 82 83 func (e unknownVersionError) Error() string { 84 return fmt.Sprintf("invalid envelope version %d", uint64(e)) 85 } 86 87 // 88 // 89 // 90 // 91 // 92 // 93 type MailServer interface { 94 Archive(env *Envelope) 95 DeliverMail(whisperPeer *Peer, request *Envelope) 96 }