Compare commits

..

4 Commits

Author SHA1 Message Date
amery c421dd5ca8 WIP
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-08-26 16:09:48 +01:00
amery 107b0d5ea5 zones: change WriteEnv() to not fake gateways
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-08-26 03:33:39 +00:00
amery fa58cf8d43 zones: add Zone.SetGateway() to set one by ID
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-08-26 03:33:39 +00:00
amery c10dc4545d zones: set first node of a Zone as ring0 gateway if it doesn't have one already
Signed-off-by: Alejandro Mery <amery@jpi.io>
2023-08-26 03:33:39 +00:00
9 changed files with 285 additions and 410 deletions
+1 -10
View File
@@ -16,19 +16,10 @@ var envCmd = &cobra.Command{
return err
}
_, err = m.Env(*envExport).WriteTo(os.Stdout)
return err
return m.WriteEnv(os.Stdout)
},
}
// Command Flags
var (
envExport *bool
)
func init() {
rootCmd.AddCommand(envCmd)
envExport = envCmd.PersistentFlags().BoolP("export", "e", false,
"export generated variables")
}
-6
View File
@@ -23,16 +23,12 @@ var configTemplate = template.Must(template.New("config").Funcs(template.FuncMap
return strings.Join(s, sep)
},
}).Parse(`[Interface]
{{if .Interface.Name}}# Name: {{.Interface.Name}}
{{end -}}
Address = {{.Interface.Address}}
PrivateKey = {{.Interface.PrivateKey}}
ListenPort = {{.Interface.ListenPort}}
{{- range .Peer }}
[Peer]
{{if .Name}}# Name: {{.Name}}
{{end -}}
PublicKey = {{.PublicKey}}
Endpoint = {{.Endpoint}}
AllowedIPs = {{ PrefixJoin .AllowedIPs ", "}}
@@ -68,7 +64,6 @@ func (f *Config) WriteTo(w io.Writer) (int64, error) {
// InterfaceConfig represents the [Interface] section
type InterfaceConfig struct {
Name string
Address netip.Addr
PrivateKey PrivateKey
ListenPort uint16
@@ -76,7 +71,6 @@ type InterfaceConfig struct {
// PeerConfig represents a [Peer] section
type PeerConfig struct {
Name string
PublicKey PublicKey
Endpoint EndpointAddress
AllowedIPs []netip.Prefix
+4 -4
View File
@@ -51,12 +51,12 @@ func (pub PublicKey) String() string {
}
}
// MarshalJSON encodes the key for JSON, omitting empty.
// MarshalJSON encodes the key for JSON, omiting empty.
func (key PrivateKey) MarshalJSON() ([]byte, error) {
return encodeKeyJSON(key.String())
}
// MarshalJSON encodes the key for JSON, omitting empty.
// MarshalJSON encodes the key for JSON, omiting empty.
func (pub PublicKey) MarshalJSON() ([]byte, error) {
return encodeKeyJSON(pub.String())
}
@@ -70,12 +70,12 @@ func encodeKeyJSON(s string) ([]byte, error) {
return out, nil
}
// MarshalYAML encodes the key for YAML, omitting empty.
// MarshalYAML encodes the key for YAML, omiting empty.
func (key PrivateKey) MarshalYAML() (any, error) {
return encodeKeyYAML(key.String())
}
// MarshalYAML encodes the key for YAML, omitting empty.
// MarshalYAML encodes the key for YAML, omiting empty.
func (pub PublicKey) MarshalYAML() (any, error) {
return encodeKeyYAML(pub.String())
}
+12 -34
View File
@@ -7,23 +7,8 @@ import (
"strings"
)
// Env is a shell environment factory for this cluster
type Env struct {
ZoneIterator
export bool
}
// Env returns a shell environment factory
func (m *Zones) Env(export bool) *Env {
return &Env{
ZoneIterator: m,
export: export,
}
}
// WriteTo generates environment variables for shell scripts
func (m *Env) WriteTo(w io.Writer) (int64, error) {
// WriteEnv generates environment variables for shell scripts
func (m *Zones) WriteEnv(w io.Writer) error {
var buf bytes.Buffer
m.writeEnvVarFn(&buf, genEnvZones, "ZONES")
@@ -32,10 +17,11 @@ func (m *Env) WriteTo(w io.Writer) (int64, error) {
return false
})
return buf.WriteTo(w)
_, err := buf.WriteTo(w)
return err
}
func (m *Env) writeEnvZone(w io.Writer, z *Zone) {
func (m *Zones) writeEnvZone(w io.Writer, z *Zone) {
zoneID := z.ID
// ZONE{zoneID}
@@ -56,7 +42,7 @@ func (m *Env) writeEnvZone(w io.Writer, z *Zone) {
}
}
func (m *Env) writeEnvVarFn(w io.Writer, fn func(*Env) string, name string, args ...any) {
func (m *Zones) writeEnvVarFn(w io.Writer, fn func(*Zones) string, name string, args ...any) {
var value string
if fn != nil {
@@ -66,13 +52,7 @@ func (m *Env) writeEnvVarFn(w io.Writer, fn func(*Env) string, name string, args
m.writeEnvVar(w, value, name, args...)
}
func (m *Env) writeEnvVar(w io.Writer, value string, name string, args ...any) {
var prefix string
if m.export {
prefix = "export "
}
func (*Zones) writeEnvVar(w io.Writer, value string, name string, args ...any) {
if len(args) > 0 {
name = fmt.Sprintf(name, args...)
}
@@ -80,17 +60,15 @@ func (m *Env) writeEnvVar(w io.Writer, value string, name string, args ...any) {
if name != "" {
value = strings.TrimSpace(value)
_, _ = fmt.Fprintf(w, "%s%s=%q\n", prefix, name, value)
_, _ = fmt.Fprintf(w, "%s=%q\n", name, value)
}
}
func genEnvZones(m *Env) string {
var s []string
m.ForEachZone(func(z *Zone) bool {
func genEnvZones(m *Zones) string {
s := make([]string, 0, len(m.Zones))
for _, z := range m.Zones {
s = append(s, fmt.Sprintf("%v", z.ID))
return false
})
}
return strings.Join(s, " ")
}
+65
View File
@@ -3,6 +3,7 @@ package zones
import (
"bytes"
"fmt"
"io/fs"
"os"
"darvaza.org/core"
@@ -72,6 +73,38 @@ func (m *Machine) tryReadWireguardKeys(ring int) error {
}
}
// WriteWireguardKeys writes the wgN.key/wgN.pub files
func (m *Machine) WriteWireguardKeys(ring int) error {
var err error
var key, pub string
var ri *RingInfo
ri, _ = m.getRingInfo(ring)
if ri != nil {
key = ri.Keys.PrivateKey.String()
pub = ri.Keys.PublicKey.String()
}
switch {
case key == "":
return fs.ErrNotExist
case pub == "":
pub = ri.Keys.PrivateKey.Public().String()
}
err = m.WriteStringFile(key+"\n", "wg%v.key", ring)
if err != nil {
return err
}
err = m.WriteStringFile(pub+"\n", "wg%v.pub", ring)
if err != nil {
return err
}
return nil
}
// RemoveWireguardKeys deletes wgN.key and wgN.pub from
// the machine's config directory
func (m *Machine) RemoveWireguardKeys(ring int) error {
@@ -229,6 +262,38 @@ func (m *Machine) RemoveWireguardConfig(ring int) error {
return err
}
// SyncWireguardConfig updates all wgN.conf files for the specified
// ring
func (m *Machine) SyncWireguardConfig(ring int) error {
return m.zone.SyncWireguardConfig(ring)
}
// WriteWireguardConfig ...
func (m *Machine) WriteWireguardConfig(ring int) error {
r, err := NewRing(m.zone, ring)
if err != nil {
return err
}
return m.writeWireguardRingConfig(r)
}
func (m *Machine) writeWireguardRingConfig(r *Ring) error {
wg, err := r.ExportConfig(m)
if err != nil {
return nil
}
f, err := m.CreateTruncFile("wg%v.conf", r.ID)
if err != nil {
return err
}
defer f.Close()
_, err = wg.WriteTo(f)
return err
}
func (m *Machine) createRingInfo(ring int, enabled bool) (*RingInfo, error) {
keys, err := wireguard.NewKeyPair()
if err != nil {
+82 -78
View File
@@ -183,26 +183,32 @@ func RingOneAddress(zoneID, nodeID int) (netip.Addr, bool) {
var (
_ MachineIterator = (*Ring)(nil)
_ ZoneIterator = (*Ring)(nil)
)
// A Ring describes all peers on a ring
type Ring struct {
RingAddressEncoder
ZoneIterator
Peers []*RingPeer
}
// AddPeer adds a [Machine] to the ring
func (r *Ring) AddPeer(p *Machine) bool {
ri, ok := p.getRingInfo(r.ID)
_, ok := p.getRingInfo(r.ID)
if !ok {
return false
}
rp := r.newPeer(p)
r.Peers = append(r.Peers, rp)
return true
}
func (r *Ring) newPeer(p *Machine) *RingPeer {
nodeID := p.ID
zoneID := p.Zone()
ri, _ := p.getRingInfo(r.ID)
addr, _ := r.Encode(zoneID, nodeID)
rp := &RingPeer{
@@ -210,7 +216,6 @@ func (r *Ring) AddPeer(p *Machine) bool {
Address: addr,
PrivateKey: ri.Keys.PrivateKey,
PeerConfig: wireguard.PeerConfig{
Name: fmt.Sprintf("%s-%v", p.Name, r.ID),
PublicKey: ri.Keys.PublicKey,
Endpoint: wireguard.EndpointAddress{
Host: p.FullName(),
@@ -219,61 +224,20 @@ func (r *Ring) AddPeer(p *Machine) bool {
},
}
switch {
case r.ID == 0:
r.setRingZeroAllowedIPs(rp)
case p.IsGateway():
r.setRingOneGatewayAllowedIPs(rp)
default:
r.setRingOneNodeAllowedIPs(rp)
if r.ID == 0 {
rp.AllowRingOneNetwork(zoneID)
rp.AllowIP(addr)
} else {
rp.AllowIP(addr)
if p.IsGateway() {
zones := p.zone.zones
rp.AllowOtherRingOneNetworks(zones, zoneID)
rp.AllowRingZeroGateways(zones)
}
}
r.Peers = append(r.Peers, rp)
return true
}
func (r *Ring) setRingZeroAllowedIPs(rp *RingPeer) {
zoneID, _, _ := r.Decode(rp.Address)
// everyone on ring0 is a gateway to ring1
addr, _ := RingOneAddress(zoneID, 0)
rp.AllowCIDR(addr, 12)
// peer
rp.AllowCIDR(rp.Address, 32)
}
func (r *Ring) setRingOneGatewayAllowedIPs(rp *RingPeer) {
zoneID, _, _ := r.Decode(rp.Address)
// peer
rp.AllowCIDR(rp.Address, 32)
// ring1 gateways connect to all other ring1 networks
r.ForEachZone(func(z *Zone) bool {
if z.ID != zoneID {
addr, _ := r.Encode(z.ID, 0)
rp.AllowCIDR(addr, 12)
}
return false
})
// ring1 gateways also connect to all ring0 addresses
r.ForEachZone(func(z *Zone) bool {
z.ForEachMachine(func(p *Machine) bool {
if p.IsGateway() {
addr, _ := RingZeroAddress(z.ID, p.ID)
rp.AllowCIDR(addr, 32)
}
return false
})
return false
})
}
func (*Ring) setRingOneNodeAllowedIPs(rp *RingPeer) {
// only to the peer itself
rp.AllowCIDR(rp.Address, 32)
return rp
}
// ForEachMachine calls a function for each Machine in the ring
@@ -286,36 +250,38 @@ func (r *Ring) ForEachMachine(fn func(*Machine) bool) {
}
}
// ExportConfig builds a wgN.conf for the specified machine on the ring
// ExportConfig ...
func (r *Ring) ExportConfig(p *Machine) (*wireguard.Config, error) {
var found bool
cur, ok := r.getMachine(p)
if !ok {
return nil, fs.ErrNotExist
}
out := &wireguard.Config{
Interface: wireguard.InterfaceConfig{
Address: cur.Address,
PrivateKey: cur.PrivateKey,
ListenPort: r.Port,
},
}
for _, pp := range r.Peers {
switch {
case pp.Node == p:
// current
found = true
out.Interface.Name = pp.PeerConfig.Name
out.Interface.Address = pp.Address
out.Interface.PrivateKey = pp.PrivateKey
default:
// peer
if pp.Node != p {
pc := pp.PeerConfig
out.Peer = append(out.Peer, pc)
}
}
return out, nil
}
if !found {
return nil, fs.ErrNotExist
func (r *Ring) getMachine(p *Machine) (*RingPeer, bool) {
for _, pp := range r.Peers {
if pp.Node == p {
return pp, true
}
}
return out, nil
return nil, false
}
// A RingPeer is a node on a [Ring]
@@ -327,17 +293,55 @@ type RingPeer struct {
PeerConfig wireguard.PeerConfig
}
// AllowCIDR allows an IP range via this peer
func (rp *RingPeer) AllowCIDR(addr netip.Addr, bits int) {
cidr := netip.PrefixFrom(addr, bits)
rp.PeerConfig.AllowedIPs = append(rp.PeerConfig.AllowedIPs, cidr)
// AllowIP ...
func (rp *RingPeer) AllowIP(addr netip.Addr) {
rp.PeerConfig.AllowedIPs = append(rp.PeerConfig.AllowedIPs,
netip.PrefixFrom(addr, 32),
)
}
// NewRing composes a new Ring for Wireguard setup
func NewRing(z ZoneIterator, m MachineIterator, ring int) (*Ring, error) {
// AllowNetwork ...
func (rp *RingPeer) AllowNetwork(addr netip.Addr, bits int) {
rp.PeerConfig.AllowedIPs = append(rp.PeerConfig.AllowedIPs,
netip.PrefixFrom(addr, bits),
)
}
// AllowRingOneNetwork ...
func (rp *RingPeer) AllowRingOneNetwork(zoneID int) {
addr, _ := RingOneAddress(zoneID, 0)
rp.AllowNetwork(addr, 12)
}
// AllowOtherRingOneNetworks ...
func (rp *RingPeer) AllowOtherRingOneNetworks(m *Zones, zoneID int) {
m.ForEachZone(func(z *Zone) bool {
if z.ID != zoneID {
addr, _ := RingOneAddress(z.ID, 0)
rp.AllowNetwork(addr, 12)
}
return false
})
}
// AllowRingZeroGateways ...
func (rp *RingPeer) AllowRingZeroGateways(m *Zones) {
m.ForEachMachine(func(p *Machine) bool {
switch {
case !p.IsGateway():
// skip regular nodes
default:
addr, _ := RingZeroAddress(p.Zone(), p.ID)
rp.AllowIP(addr)
}
return false
})
}
// NewRing ...
func NewRing(m MachineIterator, ring int) (*Ring, error) {
r := &Ring{
RingAddressEncoder: Rings[ring],
ZoneIterator: z,
}
m.ForEachMachine(func(p *Machine) bool {
-272
View File
@@ -1,272 +0,0 @@
package zones
import (
"io/fs"
"os"
)
var (
_ WireguardConfigPruner = (*Zones)(nil)
_ WireguardConfigPruner = (*Zone)(nil)
_ WireguardConfigPruner = (*Machine)(nil)
_ WireguardConfigWriter = (*Zones)(nil)
_ WireguardConfigWriter = (*Zone)(nil)
_ WireguardConfigWriter = (*Machine)(nil)
_ WireguardConfigSyncer = (*Zones)(nil)
_ WireguardConfigSyncer = (*Zone)(nil)
_ WireguardConfigSyncer = (*Machine)(nil)
_ WireguardKeysWriter = (*Zones)(nil)
_ WireguardKeysWriter = (*Zone)(nil)
_ WireguardKeysWriter = (*Machine)(nil)
)
// A WireguardConfigPruner deletes wgN.conf on all machines under
// its scope with the specified ring disabled
type WireguardConfigPruner interface {
PruneWireguardConfig(ring int) error
}
// PruneWireguardConfig removes wgN.conf files of machines with
// the corresponding ring disabled on all zones
func (m *Zones) PruneWireguardConfig(ring int) error {
return pruneWireguardConfig(m, ring)
}
// PruneWireguardConfig removes wgN.conf files of machines with
// the corresponding ring disabled.
func (z *Zone) PruneWireguardConfig(ring int) error {
return pruneWireguardConfig(z, ring)
}
func pruneWireguardConfig(m MachineIterator, ring int) error {
var err error
m.ForEachMachine(func(p *Machine) bool {
err = p.PruneWireguardConfig(ring)
if os.IsNotExist(err) {
// ignore
err = nil
}
return err != nil
})
return err
}
// PruneWireguardConfig deletes the wgN.conf file if its
// presence on the ring is disabled
func (m *Machine) PruneWireguardConfig(ring int) error {
_, ok := m.getRingInfo(ring)
if !ok {
return m.RemoveWireguardConfig(ring)
}
return nil
}
// A WireguardConfigWriter rewrites all wgN.conf on all machines under
// its scope attached to that ring
type WireguardConfigWriter interface {
WriteWireguardConfig(ring int) error
}
// WriteWireguardConfig rewrites all wgN.conf on all machines
// attached to that ring
func (m *Zones) WriteWireguardConfig(ring int) error {
switch ring {
case 0:
return writeWireguardConfig(m, m, ring)
case 1:
var err error
m.ForEachZone(func(z *Zone) bool {
err = writeWireguardConfig(m, z, ring)
return err != nil
})
return err
default:
return fs.ErrInvalid
}
}
// WriteWireguardConfig rewrites all wgN.conf on all machines
// on the Zone attached to that ring
func (z *Zone) WriteWireguardConfig(ring int) error {
switch ring {
case 0:
return writeWireguardConfig(z.zones, z.zones, ring)
case 1:
return writeWireguardConfig(z.zones, z, ring)
default:
return fs.ErrInvalid
}
}
func writeWireguardConfig(z ZoneIterator, m MachineIterator, ring int) error {
r, err := NewRing(z, m, ring)
if err != nil {
return err
}
r.ForEachMachine(func(p *Machine) bool {
err = p.writeWireguardRingConfig(r)
return err != nil
})
return err
}
// WriteWireguardConfig rewrites the wgN.conf file of this Machine
// if enabled
func (m *Machine) WriteWireguardConfig(ring int) error {
r, err := NewRing(m.zone.zones, m.zone, ring)
if err != nil {
return err
}
return m.writeWireguardRingConfig(r)
}
func (m *Machine) writeWireguardRingConfig(r *Ring) error {
wg, err := r.ExportConfig(m)
if err != nil {
return nil
}
f, err := m.CreateTruncFile("wg%v.conf", r.ID)
if err != nil {
return err
}
defer f.Close()
_, err = wg.WriteTo(f)
return err
}
// A WireguardConfigSyncer updates all wgN.conf on all machines under
// its scope reflecting the state of the ring
type WireguardConfigSyncer interface {
SyncWireguardConfig(ring int) error
}
// SyncWireguardConfig updates all wgN.conf files for the specified
// ring
func (m *Zones) SyncWireguardConfig(ring int) error {
switch ring {
case 0:
return syncWireguardConfig(m, m, ring)
case 1:
var err error
m.ForEachZone(func(z *Zone) bool {
err = syncWireguardConfig(m, z, ring)
return err != nil
})
return err
default:
return fs.ErrInvalid
}
}
// SyncWireguardConfig updates all wgN.conf files for the specified
// ring
func (z *Zone) SyncWireguardConfig(ring int) error {
switch ring {
case 0:
return syncWireguardConfig(z.zones, z.zones, ring)
case 1:
return syncWireguardConfig(z.zones, z, ring)
default:
return fs.ErrInvalid
}
}
func syncWireguardConfig(z ZoneIterator, m MachineIterator, ring int) error {
r, err := NewRing(z, m, ring)
if err != nil {
return err
}
r.ForEachMachine(func(p *Machine) bool {
if _, ok := p.getRingInfo(ring); ok {
err = p.writeWireguardRingConfig(r)
} else {
err = p.RemoveWireguardConfig(ring)
}
return err != nil
})
return err
}
// SyncWireguardConfig updates all wgN.conf files for the specified
// ring
func (m *Machine) SyncWireguardConfig(ring int) error {
return m.zone.SyncWireguardConfig(ring)
}
// A WireguardKeysWriter writes the Wireguard Keys for all machines
// under its scope for the specified ring
type WireguardKeysWriter interface {
WriteWireguardKeys(ring int) error
}
// WriteWireguardKeys rewrites all wgN.{key,pub} files
func (m *Zones) WriteWireguardKeys(ring int) error {
return writeWireguardKeys(m, ring)
}
// WriteWireguardKeys rewrites all wgN.{key,pub} files on this zone
func (z *Zone) WriteWireguardKeys(ring int) error {
return writeWireguardKeys(z, ring)
}
func writeWireguardKeys(m MachineIterator, ring int) error {
var err error
m.ForEachMachine(func(p *Machine) bool {
err = p.WriteWireguardKeys(ring)
if os.IsNotExist(err) {
// ignore
err = nil
}
return err != nil
})
return err
}
// WriteWireguardKeys writes the wgN.key/wgN.pub files
func (m *Machine) WriteWireguardKeys(ring int) error {
var err error
var key, pub string
var ri *RingInfo
ri, _ = m.getRingInfo(ring)
if ri != nil {
key = ri.Keys.PrivateKey.String()
pub = ri.Keys.PublicKey.String()
}
switch {
case key == "":
return fs.ErrNotExist
case pub == "":
pub = ri.Keys.PrivateKey.Public().String()
}
err = m.WriteStringFile(key+"\n", "wg%v.key", ring)
if err != nil {
return err
}
err = m.WriteStringFile(pub+"\n", "wg%v.pub", ring)
if err != nil {
return err
}
return nil
}
+121
View File
@@ -0,0 +1,121 @@
package zones
import (
"io/fs"
"os"
)
var (
_ machineRinger = (*Zone)(nil)
_ machineRinger = (*Zones)(nil)
)
type machineRinger interface {
MachineIterator
PruneWireguardConfig(ring int) error
}
// SyncWireguardConfig updates all wgN.conf files for the specified
// ring
func (z *Zone) SyncWireguardConfig(ring int) error {
switch ring {
case 0:
return syncWireguardConfig(z.zones, ring)
case 1:
return syncWireguardConfig(z, ring)
default:
return fs.ErrInvalid
}
}
// PruneWireguardConfig removes wgN.conf files of machines with
// the corresponding ring disabled.
func (z *Zone) PruneWireguardConfig(ring int) error {
return pruneWireguardConfig(z, ring)
}
// WriteWireguardKeys rewrites all wgN.{key,pub} files on this zone
func (z *Zone) WriteWireguardKeys(ring int) error {
return writeWireguardKeys(z, ring)
}
// SyncWireguardConfig updates all wgN.conf files for the specified
// ring
func (m *Zones) SyncWireguardConfig(ring int) error {
switch ring {
case 0:
return syncWireguardConfig(m, ring)
case 1:
var err error
m.ForEachZone(func(z *Zone) bool {
err = syncWireguardConfig(z, ring)
return err != nil
})
return err
default:
return fs.ErrInvalid
}
}
// PruneWireguardConfig removes wgN.conf files of machines with
// the corresponding ring disabled on all zones
func (m *Zones) PruneWireguardConfig(ring int) error {
return pruneWireguardConfig(m, ring)
}
// WriteWireguardKeys rewrites all wgN.{key,pub} files
func (m *Zones) WriteWireguardKeys(ring int) error {
return writeWireguardKeys(m, ring)
}
func syncWireguardConfig(m machineRinger, ring int) error {
err := m.PruneWireguardConfig(ring)
if err != nil {
return err
}
r, err := NewRing(m, ring)
if err != nil {
return err
}
m.ForEachMachine(func(p *Machine) bool {
if _, ok := p.getRingInfo(ring); ok {
err = p.writeWireguardRingConfig(r)
}
return err != nil
})
return err
}
func pruneWireguardConfig(m MachineIterator, ring int) error {
var err error
m.ForEachMachine(func(p *Machine) bool {
_, ok := p.getRingInfo(ring)
if !ok {
err = p.RemoveWireguardConfig(ring)
}
return err != nil
})
return err
}
func writeWireguardKeys(m MachineIterator, ring int) error {
var err error
m.ForEachMachine(func(p *Machine) bool {
err = p.WriteWireguardKeys(ring)
if os.IsNotExist(err) {
// ignore
err = nil
}
return err != nil
})
return err
}
-6
View File
@@ -13,7 +13,6 @@ import (
var (
_ MachineIterator = (*Zone)(nil)
_ MachineIterator = (*Zones)(nil)
_ ZoneIterator = (*Zones)(nil)
)
// A MachineIterator is a set of Machines we can iterate on
@@ -21,11 +20,6 @@ type MachineIterator interface {
ForEachMachine(func(*Machine) bool)
}
// A ZoneIterator is a set of Zones we can iterate on
type ZoneIterator interface {
ForEachZone(func(*Zone) bool)
}
// Zone represents one zone in a cluster
type Zone struct {
zones *Zones