[agent/codex:gpt-5.4-mini] Read docs/RFC.md fully. Find ONE feature described in the sp... #47
2 changed files with 28 additions and 2 deletions
10
service.go
10
service.go
|
|
@ -530,7 +530,7 @@ func (service *Service) ResolveTXT(name string) ([]string, bool) {
|
|||
|
||||
// ResolveTXTRecords returns TXT records wrapped with the RFC field name for action payloads.
|
||||
//
|
||||
// service.ResolveTXTRecords("gateway.charon.lthn")
|
||||
// result, ok := service.ResolveTXTRecords("gateway.charon.lthn")
|
||||
func (service *Service) ResolveTXTRecords(name string) (ResolveTXTResult, bool) {
|
||||
record, ok := service.findRecord(name)
|
||||
if !ok {
|
||||
|
|
@ -614,6 +614,7 @@ func (service *Service) ResolveReverse(ip string) ([]string, bool) {
|
|||
}
|
||||
|
||||
// ResolveAll returns the full record set for a name, including synthesized apex NS data.
|
||||
// Missing names still return empty arrays so the action payload stays stable.
|
||||
//
|
||||
// result, ok := service.ResolveAll("charon.lthn")
|
||||
func (service *Service) ResolveAll(name string) (ResolveAllResult, bool) {
|
||||
|
|
@ -624,7 +625,12 @@ func (service *Service) ResolveAll(name string) (ResolveAllResult, bool) {
|
|||
NS: []string{"ns." + service.ZoneApex()},
|
||||
}, true
|
||||
}
|
||||
return ResolveAllResult{}, false
|
||||
return ResolveAllResult{
|
||||
A: []string{},
|
||||
AAAA: []string{},
|
||||
TXT: []string{},
|
||||
NS: []string{},
|
||||
}, true
|
||||
}
|
||||
result := resolveResult(record)
|
||||
if normalizeName(name) == service.ZoneApex() && service.ZoneApex() != "" && len(result.NS) == 0 {
|
||||
|
|
|
|||
|
|
@ -1486,6 +1486,26 @@ func TestServiceResolveAllReturnsEmptyArraysForMissingRecordValues(t *testing.T)
|
|||
}
|
||||
}
|
||||
|
||||
func TestServiceResolveAllReturnsEmptyArraysForMissingName(t *testing.T) {
|
||||
service := NewService(ServiceOptions{})
|
||||
|
||||
result, ok := service.ResolveAll("missing.charon.lthn")
|
||||
if !ok {
|
||||
t.Fatal("expected missing name to still return the array-shaped payload")
|
||||
}
|
||||
if len(result.A) != 0 || len(result.AAAA) != 0 || len(result.TXT) != 0 || len(result.NS) != 0 {
|
||||
t.Fatalf("expected empty arrays for missing name, got %#v", result)
|
||||
}
|
||||
|
||||
raw, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
t.Fatalf("expected result to marshal: %v", err)
|
||||
}
|
||||
if string(raw) != `{"a":[],"aaaa":[],"txt":[],"ns":[]}` {
|
||||
t.Fatalf("expected empty arrays in JSON, got %s", raw)
|
||||
}
|
||||
}
|
||||
|
||||
func TestServiceServeReturnsNXDOMAINWhenMissing(t *testing.T) {
|
||||
service := NewService(ServiceOptions{})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue