mirror of
https://github.com/status-im/status-go.git
synced 2025-02-18 09:47:53 +00:00
Update vendor Integrate rendezvous into status node Add a test with failover using rendezvous Use multiple servers in client Use discovery V5 by default and test that node can be started with rendezvous discovet Fix linter Update rendezvous client to one with instrumented stream Address feedback Fix test with updated topic limits Apply several suggestions Change log to debug for request errors because we continue execution Remove web3js after rebase Update rendezvous package
58 lines
1.2 KiB
Go
58 lines
1.2 KiB
Go
package net
|
|
|
|
import (
|
|
ma "github.com/multiformats/go-multiaddr"
|
|
)
|
|
|
|
// NotifyBundle implements Notifiee by calling any of the functions set on it,
|
|
// and nop'ing if they are unset. This is the easy way to register for
|
|
// notifications.
|
|
type NotifyBundle struct {
|
|
ListenF func(Network, ma.Multiaddr)
|
|
ListenCloseF func(Network, ma.Multiaddr)
|
|
|
|
ConnectedF func(Network, Conn)
|
|
DisconnectedF func(Network, Conn)
|
|
|
|
OpenedStreamF func(Network, Stream)
|
|
ClosedStreamF func(Network, Stream)
|
|
}
|
|
|
|
var _ Notifiee = (*NotifyBundle)(nil)
|
|
|
|
func (nb *NotifyBundle) Listen(n Network, a ma.Multiaddr) {
|
|
if nb.ListenF != nil {
|
|
nb.ListenF(n, a)
|
|
}
|
|
}
|
|
|
|
func (nb *NotifyBundle) ListenClose(n Network, a ma.Multiaddr) {
|
|
if nb.ListenCloseF != nil {
|
|
nb.ListenCloseF(n, a)
|
|
}
|
|
}
|
|
|
|
func (nb *NotifyBundle) Connected(n Network, c Conn) {
|
|
if nb.ConnectedF != nil {
|
|
nb.ConnectedF(n, c)
|
|
}
|
|
}
|
|
|
|
func (nb *NotifyBundle) Disconnected(n Network, c Conn) {
|
|
if nb.DisconnectedF != nil {
|
|
nb.DisconnectedF(n, c)
|
|
}
|
|
}
|
|
|
|
func (nb *NotifyBundle) OpenedStream(n Network, s Stream) {
|
|
if nb.OpenedStreamF != nil {
|
|
nb.OpenedStreamF(n, s)
|
|
}
|
|
}
|
|
|
|
func (nb *NotifyBundle) ClosedStream(n Network, s Stream) {
|
|
if nb.ClosedStreamF != nil {
|
|
nb.ClosedStreamF(n, s)
|
|
}
|
|
}
|