feat: add wakuext_listenAddresses
This commit is contained in:
parent
f87a38074a
commit
ee6bda5bcc
|
@ -74,6 +74,11 @@ func (w *gethWakuWrapper) DialPeerByID(peerID string) error {
|
|||
return errors.New("not available in WakuV1")
|
||||
}
|
||||
|
||||
// ListenAddresses function only added for compatibility with waku V2
|
||||
func (w *gethWakuWrapper) ListenAddresses() ([]string, error) {
|
||||
return nil, errors.New("not available in WakuV1")
|
||||
}
|
||||
|
||||
// PeerCount function only added for compatibility with waku V2
|
||||
func (w *gethWakuWrapper) DropPeer(peerID string) error {
|
||||
return errors.New("not available in WakuV1")
|
||||
|
|
|
@ -253,6 +253,10 @@ func (w *gethWakuV2Wrapper) DialPeerByID(peerID string) error {
|
|||
return w.waku.DialPeerByID(peerID)
|
||||
}
|
||||
|
||||
func (w *gethWakuV2Wrapper) ListenAddresses() ([]string, error) {
|
||||
return w.waku.ListenAddresses(), nil
|
||||
}
|
||||
|
||||
func (w *gethWakuV2Wrapper) DropPeer(peerID string) error {
|
||||
return w.waku.DropPeer(peerID)
|
||||
}
|
||||
|
|
|
@ -76,6 +76,8 @@ type Waku interface {
|
|||
// PeerCount
|
||||
PeerCount() int
|
||||
|
||||
ListenAddresses() ([]string, error)
|
||||
|
||||
Peers() map[string]WakuV2Peer
|
||||
|
||||
StartDiscV5() error
|
||||
|
|
|
@ -25,3 +25,7 @@ func (m *Messenger) DropPeer(peerID string) error {
|
|||
func (m *Messenger) Peers() map[string]types.WakuV2Peer {
|
||||
return m.transport.Peers()
|
||||
}
|
||||
|
||||
func (m *Messenger) ListenAddresses() ([]string, error) {
|
||||
return m.transport.ListenAddresses()
|
||||
}
|
||||
|
|
|
@ -619,6 +619,10 @@ func (t *Transport) StopDiscV5() error {
|
|||
return t.waku.StopDiscV5()
|
||||
}
|
||||
|
||||
func (t *Transport) ListenAddresses() ([]string, error) {
|
||||
return t.waku.ListenAddresses()
|
||||
}
|
||||
|
||||
func (t *Transport) AddStorePeer(address string) (string, error) {
|
||||
return t.waku.AddStorePeer(address)
|
||||
}
|
||||
|
|
|
@ -1163,6 +1163,10 @@ func (api *PublicAPI) Peers() map[string]types.WakuV2Peer {
|
|||
return api.service.messenger.Peers()
|
||||
}
|
||||
|
||||
func (api *PublicAPI) ListenAddresses() ([]string, error) {
|
||||
return api.service.messenger.ListenAddresses()
|
||||
}
|
||||
|
||||
func (api *PublicAPI) ChangeIdentityImageShowTo(showTo settings.ProfilePicturesShowToType) error {
|
||||
err := api.service.accountsDB.SaveSettingField(settings.ProfilePicturesShowTo, showTo)
|
||||
if err != nil {
|
||||
|
|
|
@ -1125,6 +1125,15 @@ func (w *Waku) Peers() map[string]types.WakuV2Peer {
|
|||
return FormatPeerStats(w.node, w.node.PeerStats())
|
||||
}
|
||||
|
||||
func (w *Waku) ListenAddresses() []string {
|
||||
addrs := w.node.ListenAddresses()
|
||||
var result []string
|
||||
for _, addr := range addrs {
|
||||
result = append(result, addr.String())
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
func (w *Waku) StartDiscV5() error {
|
||||
if w.node.DiscV5() == nil {
|
||||
return errors.New("discv5 is not setup")
|
||||
|
|
Loading…
Reference in New Issue