Using the Ring CRDT and Weave gossip, provides an interface for the weave script to allocate IP addresses in `weave run`, `weave start` and `weave expose`. See docs/ipam.md for implementation details, and site/features.md for user-visible changes.
37 lines
805 B
Go
37 lines
805 B
Go
package ipam
|
|
|
|
import (
|
|
"errors"
|
|
|
|
"github.com/weaveworks/weave/router"
|
|
)
|
|
|
|
// Exists solely for the purpose of detecting a network in which some
|
|
// peers are configured with IPAM on and some with IPAM off.
|
|
type DummyAllocator struct {
|
|
}
|
|
|
|
var (
|
|
ErrMixedConfig = errors.New("Mixed IPAM/non-IPAM configuration not supported")
|
|
)
|
|
|
|
func (alloc *DummyAllocator) OnGossipUnicast(sender router.PeerName, msg []byte) error {
|
|
return ErrMixedConfig
|
|
}
|
|
|
|
func (alloc *DummyAllocator) OnGossipBroadcast(msg []byte) (router.GossipData, error) {
|
|
return nil, ErrMixedConfig
|
|
}
|
|
|
|
func (alloc *DummyAllocator) OnGossip(msg []byte) (router.GossipData, error) {
|
|
return nil, ErrMixedConfig
|
|
}
|
|
|
|
func (alloc *DummyAllocator) Gossip() router.GossipData {
|
|
return nil
|
|
}
|
|
|
|
func (alloc *DummyAllocator) Encode() []byte {
|
|
return nil
|
|
}
|