move generic communication substrate into its own 'mesh' package
This is mostly a matter of moving some files, changing package names, changing some imports, and changing some type references. We duplicate the odd constant & global var, and the intmac/macint functions, since neither 'router' or 'mesh' nor, really,' common' are a natural home for them.
This commit is contained in:
1 parent
e5c69801a7
commit
dc9f8762ca
47 files changed
+304
-254
No files matched your search
@@ -1,8 +1,12 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/weaveworks/weave/mesh"
|
||||
)
|
||||
|
||||
// Interface to overlay network packet handling
|
||||
type NetworkOverlay interface {
|
||||
Overlay
|
||||
mesh.Overlay
|
||||
|
||||
// The routes have changed, so any cached information should
|
||||
// be discarded.
|
||||
@@ -12,7 +16,7 @@ type NetworkOverlay interface {
|
||||
InvalidateShortIDs()
|
||||
|
||||
// Start consuming forwarded packets.
|
||||
StartConsumingPackets(*Peer, *Peers, OverlayConsumer) error
|
||||
StartConsumingPackets(*mesh.Peer, *mesh.Peers, OverlayConsumer) error
|
||||
}
|
||||
|
||||
// When a consumer is called, the decoder will already have been used
|
||||
@@ -21,7 +25,7 @@ type OverlayConsumer func(ForwardPacketKey) FlowOp
|
||||
|
||||
// All of the machinery to forward packets to a particular peer
|
||||
type OverlayForwarder interface {
|
||||
OverlayConnection
|
||||
mesh.OverlayConnection
|
||||
// Forward a packet across the connection. May be called as soon
|
||||
// as the overlay connection is created, in particular before
|
||||
// Confirm(). The return value nil means the key could not be
|
||||
@@ -29,7 +33,7 @@ type OverlayForwarder interface {
|
||||
Forward(ForwardPacketKey) FlowOp
|
||||
}
|
||||
|
||||
type NullNetworkOverlay struct{ NullOverlay }
|
||||
type NullNetworkOverlay struct{ mesh.NullOverlay }
|
||||
|
||||
func (NullNetworkOverlay) InvalidateRoutes() {
|
||||
}
|
||||
@@ -37,7 +41,7 @@ func (NullNetworkOverlay) InvalidateRoutes() {
|
||||
func (NullNetworkOverlay) InvalidateShortIDs() {
|
||||
}
|
||||
|
||||
func (NullNetworkOverlay) StartConsumingPackets(*Peer, *Peers, OverlayConsumer) error {
|
||||
func (NullNetworkOverlay) StartConsumingPackets(*mesh.Peer, *mesh.Peers, OverlayConsumer) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user