feat_: wakuext_enr (#5367)
This commit is contained in:
parent
b0d103d494
commit
a300e12853
|
@ -109,6 +109,11 @@ func (w *GethWakuWrapper) ListenAddresses() ([]string, error) {
|
||||||
return nil, errors.New("not available in WakuV1")
|
return nil, errors.New("not available in WakuV1")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ENR function only added for compatibility with waku V2
|
||||||
|
func (w *GethWakuWrapper) ENR() (string, error) {
|
||||||
|
return "", errors.New("not available in WakuV1")
|
||||||
|
}
|
||||||
|
|
||||||
// PeerCount function only added for compatibility with waku V2
|
// PeerCount function only added for compatibility with waku V2
|
||||||
func (w *GethWakuWrapper) DropPeer(peerID string) error {
|
func (w *GethWakuWrapper) DropPeer(peerID string) error {
|
||||||
return errors.New("not available in WakuV1")
|
return errors.New("not available in WakuV1")
|
||||||
|
|
|
@ -283,6 +283,11 @@ func (w *gethWakuV2Wrapper) ListenAddresses() ([]string, error) {
|
||||||
return w.waku.ListenAddresses(), nil
|
return w.waku.ListenAddresses(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ENR function only added for compatibility with waku V2
|
||||||
|
func (w *gethWakuV2Wrapper) ENR() (string, error) {
|
||||||
|
return w.waku.ENR()
|
||||||
|
}
|
||||||
|
|
||||||
func (w *gethWakuV2Wrapper) DropPeer(peerID string) error {
|
func (w *gethWakuV2Wrapper) DropPeer(peerID string) error {
|
||||||
return w.waku.DropPeer(peerID)
|
return w.waku.DropPeer(peerID)
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,6 +92,8 @@ type Waku interface {
|
||||||
|
|
||||||
ListenAddresses() ([]string, error)
|
ListenAddresses() ([]string, error)
|
||||||
|
|
||||||
|
ENR() (string, error)
|
||||||
|
|
||||||
Peers() map[string]WakuV2Peer
|
Peers() map[string]WakuV2Peer
|
||||||
|
|
||||||
StartDiscV5() error
|
StartDiscV5() error
|
||||||
|
|
|
@ -36,6 +36,10 @@ func (m *Messenger) ListenAddresses() ([]string, error) {
|
||||||
return m.transport.ListenAddresses()
|
return m.transport.ListenAddresses()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Messenger) ENR() (string, error) {
|
||||||
|
return m.transport.ENR()
|
||||||
|
}
|
||||||
|
|
||||||
// Subscribe to a pubsub topic, passing an optional public key if the pubsub topic is protected
|
// Subscribe to a pubsub topic, passing an optional public key if the pubsub topic is protected
|
||||||
func (m *Messenger) SubscribeToPubsubTopic(topic string, optPublicKey *ecdsa.PublicKey) error {
|
func (m *Messenger) SubscribeToPubsubTopic(topic string, optPublicKey *ecdsa.PublicKey) error {
|
||||||
return m.transport.SubscribeToPubsubTopic(topic, optPublicKey)
|
return m.transport.SubscribeToPubsubTopic(topic, optPublicKey)
|
||||||
|
|
|
@ -651,6 +651,10 @@ func (t *Transport) ListenAddresses() ([]string, error) {
|
||||||
return t.waku.ListenAddresses()
|
return t.waku.ListenAddresses()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *Transport) ENR() (string, error) {
|
||||||
|
return t.waku.ENR()
|
||||||
|
}
|
||||||
|
|
||||||
func (t *Transport) AddStorePeer(address string) (peer.ID, error) {
|
func (t *Transport) AddStorePeer(address string) (peer.ID, error) {
|
||||||
return t.waku.AddStorePeer(address)
|
return t.waku.AddStorePeer(address)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1484,6 +1484,10 @@ func (api *PublicAPI) ListenAddresses() ([]string, error) {
|
||||||
return api.service.messenger.ListenAddresses()
|
return api.service.messenger.ListenAddresses()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (api *PublicAPI) Enr() (string, error) {
|
||||||
|
return api.service.messenger.ENR()
|
||||||
|
}
|
||||||
|
|
||||||
func (api *PublicAPI) ChangeIdentityImageShowTo(showTo settings.ProfilePicturesShowToType) error {
|
func (api *PublicAPI) ChangeIdentityImageShowTo(showTo settings.ProfilePicturesShowToType) error {
|
||||||
err := api.service.accountsDB.SaveSettingField(settings.ProfilePicturesShowTo, showTo)
|
err := api.service.accountsDB.SaveSettingField(settings.ProfilePicturesShowTo, showTo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -1692,6 +1692,15 @@ func (w *Waku) ListenAddresses() []string {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (w *Waku) ENR() (string, error) {
|
||||||
|
enr := w.node.ENR()
|
||||||
|
if enr == nil {
|
||||||
|
return "", errors.New("enr not available")
|
||||||
|
}
|
||||||
|
|
||||||
|
return enr.String(), nil
|
||||||
|
}
|
||||||
|
|
||||||
func (w *Waku) SubscribeToPubsubTopic(topic string, pubkey *ecdsa.PublicKey) error {
|
func (w *Waku) SubscribeToPubsubTopic(topic string, pubkey *ecdsa.PublicKey) error {
|
||||||
topic = w.GetPubsubTopic(topic)
|
topic = w.GetPubsubTopic(topic)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue