2021-08-30 14:57:28 +00:00
|
|
|
package protocol
|
|
|
|
|
2023-02-22 21:58:17 +00:00
|
|
|
import (
|
2023-05-22 21:38:02 +00:00
|
|
|
"crypto/ecdsa"
|
|
|
|
|
2023-02-22 21:58:17 +00:00
|
|
|
"github.com/libp2p/go-libp2p/core/peer"
|
2022-11-24 15:00:44 +00:00
|
|
|
|
2023-02-22 21:58:17 +00:00
|
|
|
"github.com/status-im/status-go/eth-node/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (m *Messenger) AddStorePeer(address string) (peer.ID, error) {
|
2021-08-30 14:57:28 +00:00
|
|
|
return m.transport.AddStorePeer(address)
|
|
|
|
}
|
|
|
|
|
2023-02-22 21:58:17 +00:00
|
|
|
func (m *Messenger) AddRelayPeer(address string) (peer.ID, error) {
|
2024-06-11 07:45:01 +00:00
|
|
|
return m.transport.AddRelayPeer(address)
|
2021-08-30 14:57:28 +00:00
|
|
|
}
|
|
|
|
|
2021-09-10 17:06:06 +00:00
|
|
|
func (m *Messenger) DialPeer(address string) error {
|
|
|
|
return m.transport.DialPeer(address)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Messenger) DialPeerByID(peerID string) error {
|
|
|
|
return m.transport.DialPeerByID(peerID)
|
|
|
|
}
|
|
|
|
|
2021-08-30 14:57:28 +00:00
|
|
|
func (m *Messenger) DropPeer(peerID string) error {
|
|
|
|
return m.transport.DropPeer(peerID)
|
|
|
|
}
|
|
|
|
|
2022-11-24 15:00:44 +00:00
|
|
|
func (m *Messenger) Peers() map[string]types.WakuV2Peer {
|
2021-08-30 14:57:28 +00:00
|
|
|
return m.transport.Peers()
|
|
|
|
}
|
2022-11-24 21:27:46 +00:00
|
|
|
|
|
|
|
func (m *Messenger) ListenAddresses() ([]string, error) {
|
|
|
|
return m.transport.ListenAddresses()
|
|
|
|
}
|
2023-05-22 21:38:02 +00:00
|
|
|
|
2024-06-18 19:48:49 +00:00
|
|
|
func (m *Messenger) ENR() (string, error) {
|
|
|
|
return m.transport.ENR()
|
|
|
|
}
|
|
|
|
|
2023-05-22 21:38:02 +00:00
|
|
|
// 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 {
|
|
|
|
return m.transport.SubscribeToPubsubTopic(topic, optPublicKey)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *Messenger) StorePubsubTopicKey(topic string, privKey *ecdsa.PrivateKey) error {
|
|
|
|
return m.transport.StorePubsubTopicKey(topic, privKey)
|
|
|
|
}
|