adds DialbyPeerID

This commit is contained in:
Richard Ramos 2021-08-31 15:17:56 -04:00 committed by Vitaliy Vlasov
parent 11bf973daf
commit 4450e6bba0
1 changed files with 5 additions and 1 deletions

View File

@ -697,7 +697,6 @@ func (w *WakuNode) DialPeer(address string) error {
return err
}
// Extract the peer ID from the multiaddr.
info, err := peer.AddrInfoFromP2pAddr(p)
if err != nil {
return err
@ -706,6 +705,11 @@ func (w *WakuNode) DialPeer(address string) error {
return w.host.Connect(w.ctx, *info)
}
func (w *WakuNode) DialPeerByID(peerID peer.ID) error {
info := w.host.Peerstore().PeerInfo(peerID)
return w.host.Connect(w.ctx, info)
}
func (w *WakuNode) ClosePeerByAddress(address string) error {
p, err := ma.NewMultiaddr(address)
if err != nil {