From 8a8390e4f7d303faf21223238f5ccccd28e92c91 Mon Sep 17 00:00:00 2001 From: Yusef Napora Date: Fri, 20 Dec 2019 15:59:54 -0500 Subject: [PATCH] add events for updated addresses and routing state --- event/addrs.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 event/addrs.go diff --git a/event/addrs.go b/event/addrs.go new file mode 100644 index 0000000..d39024e --- /dev/null +++ b/event/addrs.go @@ -0,0 +1,25 @@ +package event + +import ( + "github.com/libp2p/go-libp2p-core/routing" + ma "github.com/multiformats/go-multiaddr" +) + +// EvtLocalAddressesUpdated should be emitted when the set of listen addresses for +// the local host changes. This may happen for a number of reasons. For example, +// we may have opened a new relay connection, established a new NAT mapping via +// UPnP, or been informed of our observed address by another peer. +type EvtLocalAddressesUpdated struct { + // Added enumerates the listen addresses that were added for the local peer. + Added []ma.Multiaddr + + // Removed enumerates listen addresses that were removed from the local peer. + Removed []ma.Multiaddr +} + +// EvtLocalPeerRoutingStateUpdated should be emitted when a new SignedRoutingState +// record for the local peer has been produced. This will happen whenever the set +// of listen addresses changes. +type EvtLocalPeerRoutingStateUpdated struct { + State *routing.SignedRoutingState +}