Documentation ¶
Index ¶
- Variables
- type ConnStatus
- type ConnectionNotifier
- func (c ConnectionNotifier) Close()
- func (c ConnectionNotifier) ClosedStream(n network.Network, s network.Stream)
- func (c ConnectionNotifier) Connected(n network.Network, cc network.Conn)
- func (c ConnectionNotifier) Disconnected(n network.Network, cc network.Conn)
- func (c ConnectionNotifier) Listen(n network.Network, m multiaddr.Multiaddr)
- func (c ConnectionNotifier) ListenClose(n network.Network, m multiaddr.Multiaddr)
- func (c ConnectionNotifier) OpenedStream(n network.Network, s network.Stream)
- type MembershipKeyPair
- type Peer
- type PeerConnectorService
- type PeerStats
- type RLNRelay
- type ReceptorService
- type Service
- type VersionInfo
- type WakuNode
- func (w *WakuNode) AddPeer(address ma.Multiaddr, protocols ...protocol.ID) (peer.ID, error)
- func (w *WakuNode) Broadcaster() v2.Broadcaster
- func (w *WakuNode) ClosePeerByAddress(address string) error
- func (w *WakuNode) ClosePeerById(id peer.ID) error
- func (w *WakuNode) DialPeer(ctx context.Context, address string) error
- func (w *WakuNode) DialPeerByID(ctx context.Context, peerID peer.ID) error
- func (w *WakuNode) DialPeerWithMultiAddress(ctx context.Context, address ma.Multiaddr) error
- func (w *WakuNode) DiscV5() *discv5.DiscoveryV5
- func (w *WakuNode) ENR() *enode.Node
- func (w *WakuNode) Filter() *filter.WakuFilter
- func (w *WakuNode) FilterV2() *filterv2.WakuFilterLightnode
- func (w *WakuNode) Host() host.Host
- func (w *WakuNode) ID() string
- func (w *WakuNode) Lightpush() *lightpush.WakuLightPush
- func (w *WakuNode) ListenAddresses() []ma.Multiaddr
- func (w *WakuNode) PeerCount() int
- func (w *WakuNode) PeerExchange() *peer_exchange.WakuPeerExchange
- func (w *WakuNode) PeerStats() PeerStats
- func (w *WakuNode) Peers() ([]*Peer, error)
- func (w *WakuNode) Publish(ctx context.Context, msg *pb.WakuMessage) error
- func (w *WakuNode) RLNRelay() RLNRelay
- func (w *WakuNode) Relay() *relay.WakuRelay
- func (w *WakuNode) SetDiscV5Bootnodes(nodes []*enode.Node) error
- func (w *WakuNode) Start(ctx context.Context) error
- func (w *WakuNode) Status() (isOnline bool, hasHistory bool)
- func (w *WakuNode) Stop()
- func (w *WakuNode) Store() store.Store
- func (w *WakuNode) Timesource() timesource.Timesource
- type WakuNodeOption
- func NoDefaultWakuTopic() WakuNodeOption
- func WithAdvertiseAddresses(advertiseAddrs ...ma.Multiaddr) WakuNodeOption
- func WithConnectionStatusChannel(connStatus chan ConnStatus) WakuNodeOption
- func WithDiscoverParams(minPeers int) WakuNodeOption
- func WithDiscoveryV5(udpPort uint, bootnodes []*enode.Node, autoUpdate bool) WakuNodeOption
- func WithDns4Domain(dns4Domain string) WakuNodeOption
- func WithHostAddress(hostAddr *net.TCPAddr) WakuNodeOption
- func WithKeepAlive(t time.Duration) WakuNodeOption
- func WithLibP2POptions(opts ...libp2p.Option) WakuNodeOption
- func WithLightPush() WakuNodeOption
- func WithLogLevel(lvl zapcore.Level) WakuNodeOption
- func WithLogger(l *zap.Logger) WakuNodeOption
- func WithMessageProvider(s store.MessageProvider) WakuNodeOption
- func WithMultiaddress(addresses []multiaddr.Multiaddr) WakuNodeOption
- func WithNTP(ntpURLs ...string) WakuNodeOption
- func WithPeerExchange() WakuNodeOption
- func WithPrivateKey(privKey *ecdsa.PrivateKey) WakuNodeOption
- func WithSecureWebsockets(address string, port int, certPath string, keyPath string) WakuNodeOption
- func WithWakuFilter(fullNode bool, filterOpts ...filter.Option) WakuNodeOption
- func WithWakuFilterV2FullNode(filterOpts ...filter.Option) WakuNodeOption
- func WithWakuFilterV2LightNode() WakuNodeOption
- func WithWakuRelay(opts ...pubsub.Option) WakuNodeOption
- func WithWakuRelayAndMinPeers(minRelayPeersToPublish int, opts ...pubsub.Option) WakuNodeOption
- func WithWakuStore(resumeNodes ...multiaddr.Multiaddr) WakuNodeOption
- func WithWakuStoreFactory(factory storeFactory) WakuNodeOption
- func WithWakuSwap(mode int, disconnectThreshold, paymentThreshold int) WakuNodeOption
- func WithWebsockets(address string, port int) WakuNodeOption
- type WakuNodeParameters
Constants ¶
This section is empty.
Variables ¶
var DefaultLibP2POptions = []libp2p.Option{ libp2p.ChainOptions( libp2p.Transport(tcp.NewTCPTransport), libp2p.Transport(quic.NewTransport), ), libp2p.UserAgent(userAgent), libp2p.ChainOptions( libp2p.Muxer("/yamux/1.0.0", yamux.DefaultTransport), libp2p.Muxer("/mplex/6.7.0", mplex.DefaultTransport), ), libp2p.EnableNATService(), libp2p.ConnectionManager(newConnManager(200, 300, connmgr.WithGracePeriod(0))), }
Default options used in the libp2p node
var DefaultWakuNodeOptions = []WakuNodeOption{ WithDiscoverParams(150), }
Default options used in the libp2p node
var GitCommit string
GitCommit is a commit hash.
var Version string
Version is the version of go-waku at the time of compilation
Functions ¶
This section is empty.
Types ¶
type ConnStatus ¶
ConnStatus is used to indicate if the node is online, has access to history and also see the list of peers the node is aware of
type ConnectionNotifier ¶
type ConnectionNotifier struct { DisconnectChan chan peer.ID // contains filtered or unexported fields }
ConnectionNotifier is a custom Notifier to be used to display when a peer connects or disconnects to the node
func NewConnectionNotifier ¶
func (ConnectionNotifier) Close ¶
func (c ConnectionNotifier) Close()
Close quits the ConnectionNotifier
func (ConnectionNotifier) ClosedStream ¶
func (c ConnectionNotifier) ClosedStream(n network.Network, s network.Stream)
ClosedStream is called when a stream closed
func (ConnectionNotifier) Connected ¶
func (c ConnectionNotifier) Connected(n network.Network, cc network.Conn)
Connected is called when a connection is opened
func (ConnectionNotifier) Disconnected ¶
func (c ConnectionNotifier) Disconnected(n network.Network, cc network.Conn)
Disconnected is called when a connection closed
func (ConnectionNotifier) Listen ¶
func (c ConnectionNotifier) Listen(n network.Network, m multiaddr.Multiaddr)
Listen is called when network starts listening on an addr
func (ConnectionNotifier) ListenClose ¶
func (c ConnectionNotifier) ListenClose(n network.Network, m multiaddr.Multiaddr)
ListenClose is called when network stops listening on an address
func (ConnectionNotifier) OpenedStream ¶
func (c ConnectionNotifier) OpenedStream(n network.Network, s network.Stream)
OpenedStream is called when a stream opened
type MembershipKeyPair ¶
type PeerConnectorService ¶ added in v0.4.0
type RLNRelay ¶
type RLNRelay interface { MembershipKeyPair() *MembershipKeyPair MembershipIndex() uint MembershipContractAddress() common.Address AppendRLNProof(msg *pb.WakuMessage, senderEpochTime time.Time) error Stop() }
type ReceptorService ¶ added in v0.4.0
type VersionInfo ¶
func GetVersionInfo ¶
func GetVersionInfo() VersionInfo
func (VersionInfo) String ¶
func (v VersionInfo) String() string
type WakuNode ¶
type WakuNode struct {
// contains filtered or unexported fields
}
func New ¶
func New(opts ...WakuNodeOption) (*WakuNode, error)
New is used to instantiate a WakuNode using a set of WakuNodeOptions
func (*WakuNode) AddPeer ¶
AddPeer is used to add a peer and the protocols it support to the node peerstore
func (*WakuNode) Broadcaster ¶
func (w *WakuNode) Broadcaster() v2.Broadcaster
Broadcaster is used to access the message broadcaster that is used to push messages to different protocols
func (*WakuNode) ClosePeerByAddress ¶
ClosePeerByAddress is used to disconnect from a peer using its multiaddress
func (*WakuNode) ClosePeerById ¶
ClosePeerById is used to close a connection to a peer
func (*WakuNode) DialPeer ¶
DialPeer is used to connect to a peer using a string containing a multiaddress
func (*WakuNode) DialPeerByID ¶
DialPeerByID is used to connect to an already known peer
func (*WakuNode) DialPeerWithMultiAddress ¶
DialPeerWithMultiAddress is used to connect to a peer using a multiaddress
func (*WakuNode) DiscV5 ¶
func (w *WakuNode) DiscV5() *discv5.DiscoveryV5
DiscV5 is used to access any operation related to DiscoveryV5
func (*WakuNode) Filter ¶
func (w *WakuNode) Filter() *filter.WakuFilter
Filter is used to access any operation related to Waku Filter protocol
func (*WakuNode) FilterV2 ¶ added in v0.5.0
func (w *WakuNode) FilterV2() *filterv2.WakuFilterLightnode
FilterV2 is used to access any operation related to Waku Filter protocol
func (*WakuNode) Lightpush ¶
func (w *WakuNode) Lightpush() *lightpush.WakuLightPush
Lightpush is used to access any operation related to Waku Lightpush protocol
func (*WakuNode) ListenAddresses ¶
ListenAddresses returns all the multiaddresses used by the host
func (*WakuNode) PeerExchange ¶
func (w *WakuNode) PeerExchange() *peer_exchange.WakuPeerExchange
PeerExchange is used to access any operation related to Peer Exchange
func (*WakuNode) Peers ¶
Peers return the list of peers, addresses, protocols supported and connection status
func (*WakuNode) Publish ¶
Publish will attempt to publish a message via WakuRelay if there are enough peers available, otherwise it will attempt to publish via Lightpush protocol
func (*WakuNode) SetDiscV5Bootnodes ¶
Set the bootnodes on discv5
func (*WakuNode) Status ¶
Status returns the current status of the node (online or not) and if the node has access to history nodes or not
func (*WakuNode) Stop ¶
func (w *WakuNode) Stop()
Stop stops the WakuNode and closess all connections to the host
func (*WakuNode) Timesource ¶
func (w *WakuNode) Timesource() timesource.Timesource
Timesource returns the timesource used by this node to obtain the current wall time Depending on the configuration it will be the local time or a ntp syncd time
type WakuNodeOption ¶
type WakuNodeOption func(*WakuNodeParameters) error
func NoDefaultWakuTopic ¶ added in v0.5.0
func NoDefaultWakuTopic() WakuNodeOption
NoDefaultWakuTopic will stop the node from subscribing to the default pubsub topic automatically
func WithAdvertiseAddresses ¶ added in v0.5.0
func WithAdvertiseAddresses(advertiseAddrs ...ma.Multiaddr) WakuNodeOption
WithAdvertiseAddresses is a WakuNodeOption that allows overriding the address used in the waku node with custom value
func WithConnectionStatusChannel ¶
func WithConnectionStatusChannel(connStatus chan ConnStatus) WakuNodeOption
WithConnectionStatusChannel is a WakuNodeOption used to set a channel where the connection status changes will be pushed to. It's useful to identify when peer connections and disconnections occur
func WithDiscoverParams ¶ added in v0.4.0
func WithDiscoverParams(minPeers int) WakuNodeOption
func WithDiscoveryV5 ¶
func WithDiscoveryV5(udpPort uint, bootnodes []*enode.Node, autoUpdate bool) WakuNodeOption
WithDiscoveryV5 is a WakuOption used to enable DiscV5 peer discovery
func WithDns4Domain ¶
func WithDns4Domain(dns4Domain string) WakuNodeOption
WithDns4Domain is a WakuNodeOption that adds a custom domain name to listen
func WithHostAddress ¶
func WithHostAddress(hostAddr *net.TCPAddr) WakuNodeOption
WithHostAddress is a WakuNodeOption that configures libp2p to listen on a specific address
func WithKeepAlive ¶
func WithKeepAlive(t time.Duration) WakuNodeOption
WithKeepAlive is a WakuNodeOption used to set the interval of time when each peer will be ping to keep the TCP connection alive
func WithLibP2POptions ¶
func WithLibP2POptions(opts ...libp2p.Option) WakuNodeOption
WithLibP2POptions is a WakuNodeOption used to configure the libp2p node. This can potentially override any libp2p config that was set with other WakuNodeOption
func WithLightPush ¶
func WithLightPush() WakuNodeOption
WithLightPush is a WakuNodeOption that enables the lightpush protocol
func WithLogLevel ¶ added in v0.5.0
func WithLogLevel(lvl zapcore.Level) WakuNodeOption
WithLogLevel is a WakuNodeOption that sets the log level for go-waku
func WithLogger ¶
func WithLogger(l *zap.Logger) WakuNodeOption
WithLogger is a WakuNodeOption that adds a custom logger
func WithMessageProvider ¶
func WithMessageProvider(s store.MessageProvider) WakuNodeOption
WithMessageProvider is a WakuNodeOption that sets the MessageProvider used to store and retrieve persisted messages
func WithMultiaddress ¶
func WithMultiaddress(addresses []multiaddr.Multiaddr) WakuNodeOption
WithMultiaddress is a WakuNodeOption that configures libp2p to listen on a list of multiaddresses
func WithNTP ¶
func WithNTP(ntpURLs ...string) WakuNodeOption
WithNTP is used to use ntp for any operation that requires obtaining time A list of ntp servers can be passed but if none is specified, some defaults will be used
func WithPeerExchange ¶
func WithPeerExchange() WakuNodeOption
WithPeerExchange is a WakuOption used to enable Peer Exchange
func WithPrivateKey ¶
func WithPrivateKey(privKey *ecdsa.PrivateKey) WakuNodeOption
WithPrivateKey is used to set an ECDSA private key in a libp2p node
func WithSecureWebsockets ¶
func WithSecureWebsockets(address string, port int, certPath string, keyPath string) WakuNodeOption
WithSecureWebsockets is a WakuNodeOption used to enable secure websockets support
func WithWakuFilter ¶
func WithWakuFilter(fullNode bool, filterOpts ...filter.Option) WakuNodeOption
WithWakuFilter enables the Waku Filter protocol. This WakuNodeOption accepts a list of WakuFilter gossipsub options to setup the protocol
func WithWakuFilterV2FullNode ¶ added in v0.5.0
func WithWakuFilterV2FullNode(filterOpts ...filter.Option) WakuNodeOption
WithWakuFilterV2FullNode enables the Waku Filter V2 protocol full node functionality. This WakuNodeOption accepts a list of WakuFilter options to setup the protocol
func WithWakuFilterV2LightNode ¶ added in v0.5.0
func WithWakuFilterV2LightNode() WakuNodeOption
WithWakuFilterV2 enables the Waku Filter V2 protocol for lightnode functionality
func WithWakuRelay ¶
func WithWakuRelay(opts ...pubsub.Option) WakuNodeOption
WithWakuRelay enables the Waku V2 Relay protocol. This WakuNodeOption accepts a list of WakuRelay gossipsub option to setup the protocol
func WithWakuRelayAndMinPeers ¶
func WithWakuRelayAndMinPeers(minRelayPeersToPublish int, opts ...pubsub.Option) WakuNodeOption
WithWakuRelayAndMinPeers enables the Waku V2 Relay protocol. This WakuNodeOption accepts a min peers require to publish and a list of WakuRelay gossipsub option to setup the protocol
func WithWakuStore ¶
func WithWakuStore(resumeNodes ...multiaddr.Multiaddr) WakuNodeOption
WithWakuStore enables the Waku V2 Store protocol and if the messages should be stored or not in a message provider. If resumeNodes are specified, the store will attempt to resume message history using those nodes
func WithWakuStoreFactory ¶
func WithWakuStoreFactory(factory storeFactory) WakuNodeOption
WithWakuStoreFactory is used to replace the default WakuStore with a custom implementation that implements the store.Store interface
func WithWakuSwap ¶
func WithWakuSwap(mode int, disconnectThreshold, paymentThreshold int) WakuNodeOption
WithWakuSwap set the option of the Waku V2 Swap protocol
func WithWebsockets ¶
func WithWebsockets(address string, port int) WakuNodeOption
WithWebsockets is a WakuNodeOption used to enable websockets support
type WakuNodeParameters ¶
type WakuNodeParameters struct {
// contains filtered or unexported fields
}
func (WakuNodeParameters) AddressFactory ¶
func (w WakuNodeParameters) AddressFactory() basichost.AddrsFactory
AddressFactory returns the address factory used by the node's host
func (*WakuNodeParameters) GetPrivKey ¶
func (w *WakuNodeParameters) GetPrivKey() *crypto.PrivKey
GetPrivKey returns the private key used in the node
func (WakuNodeParameters) Identity ¶
func (w WakuNodeParameters) Identity() config.Option
Identity returns a libp2p option containing the identity used by the node
func (WakuNodeParameters) MultiAddresses ¶
func (w WakuNodeParameters) MultiAddresses() []multiaddr.Multiaddr
MultiAddresses return the list of multiaddresses configured in the node
func (WakuNodeParameters) TLSConfig ¶
func (w WakuNodeParameters) TLSConfig() *tls.Config
TLSConfig returns the TLS config used for setting up secure websockets