whisper/whisperv6 | whisper peer dns discovery

This commit is contained in:
ucwong 2020-04-01 15:43:55 +08:00
parent f0be151349
commit 23a32c0060

View file

@ -31,6 +31,8 @@ import (
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/p2p"
"github.com/ethereum/go-ethereum/p2p/dnsdisc"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rpc"
"github.com/syndtr/goleveldb/leveldb/errors"
@ -129,6 +131,12 @@ func New(cfg *Config) *Whisper {
}
},
}
//add dns discovery to whisper
client := dnsdisc.NewClient(dnsdisc.Config{})
s, err := client.NewIterator([]string{params.KnownDNSNetworks[params.MainnetGenesisHash]}...)
if err == nil {
whisper.protocol.DialCandidates = s
}
return whisper
}