Changed to new URL scheme with container identifier

Implementation matches design.md better:
 - http action changes from POST /add to PUT /name
 - each record now has the container identifier
This commit is contained in:
Bryan Boreham committed 2014-10-14 11:55:45 +01:00
1 parent 50d343e2fb
commit 6bff651e87
4 files changed
+49 -20

No files matched your search

+4 -3
View File
@@ -8,11 +8,12 @@ import (
)
type Zone interface {
AddRecord(string, net.IP, net.IP, *net.IPNet) error
AddRecord(string, string, net.IP, net.IP, *net.IPNet) error
MatchLocal(string) (net.IP, error)
}
type Record struct {
Ident string
Name string
Ip net.IP
WeaveIp net.IP
@@ -47,9 +48,9 @@ func (zone *ZoneDb) MatchLocal(name string) (net.IP, error) {
return zone.match(name)
}
func (zone *ZoneDb) AddRecord(name string, ip net.IP, weave_ip net.IP, weave_subnet *net.IPNet) error {
func (zone *ZoneDb) AddRecord(identifier string, name string, ip net.IP, weave_ip net.IP, weave_subnet *net.IPNet) error {
zone.mx.Lock()
defer zone.mx.Unlock()
zone.recs = append(zone.recs, Record{dns.Fqdn(name), ip, weave_ip, weave_subnet})
zone.recs = append(zone.recs, Record{identifier, dns.Fqdn(name), ip, weave_ip, weave_subnet})
return nil
}