5019ef26ad
Signed-off-by: Alejandro Mery <amery@jpi.io>
32 lines
454 B
Go
32 lines
454 B
Go
package dns
|
|
|
|
import (
|
|
"context"
|
|
"io/fs"
|
|
"net/netip"
|
|
)
|
|
|
|
func (mgr *Manager) AddHost(_ context.Context, zone string, id int, active bool, addrs ...netip.Addr) error {
|
|
if zone == "" || id <= 0 {
|
|
return fs.ErrInvalid
|
|
}
|
|
|
|
z, ok := mgr.zones[zone]
|
|
if !ok {
|
|
z = &Zone{
|
|
Name: zone,
|
|
Machines: make(map[int]*Machine),
|
|
}
|
|
|
|
mgr.zones[zone] = z
|
|
}
|
|
|
|
z.Machines[id] = &Machine{
|
|
ID: id,
|
|
Active: active,
|
|
Addrs: addrs,
|
|
}
|
|
|
|
return nil
|
|
}
|