aboutsummaryrefslogtreecommitdiffstats
path: root/whisper
diff options
context:
space:
mode:
authorTaylor Gerring <taylor.gerring@gmail.com>2015-03-25 19:08:48 +0800
committerTaylor Gerring <taylor.gerring@gmail.com>2015-03-25 19:08:48 +0800
commitc956bcb13c287baf1d4ae1b2c9ae83d43423d67f (patch)
tree5bf71d761cc9b948f3d435df26425e82c00121e5 /whisper
parentd41341f77d03a7ab8483cd9df4bc71ac08bbfc7c (diff)
downloaddexon-c956bcb13c287baf1d4ae1b2c9ae83d43423d67f.tar.gz
dexon-c956bcb13c287baf1d4ae1b2c9ae83d43423d67f.tar.zst
dexon-c956bcb13c287baf1d4ae1b2c9ae83d43423d67f.zip
Move version to const and expose via Version()
Diffstat (limited to 'whisper')
-rw-r--r--whisper/whisper.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/whisper/whisper.go b/whisper/whisper.go
index dbd4fc85f..1d019aea5 100644
--- a/whisper/whisper.go
+++ b/whisper/whisper.go
@@ -16,8 +16,9 @@ import (
)
const (
- statusMsg = 0x0
- envelopesMsg = 0x01
+ statusMsg = 0x0
+ envelopesMsg = 0x01
+ whisperVersion = 0x02
)
type MessageEvent struct {
@@ -56,7 +57,7 @@ func New() *Whisper {
// p2p whisper sub protocol handler
whisper.protocol = p2p.Protocol{
Name: "shh",
- Version: 2,
+ Version: uint(whisperVersion),
Length: 2,
Run: whisper.msgHandler,
}
@@ -64,6 +65,10 @@ func New() *Whisper {
return whisper
}
+func (self *Whisper) Version() uint {
+ return self.protocol.Version
+}
+
func (self *Whisper) Start() {
wlogger.Infoln("Whisper started")
go self.update()