[agent/codex:gpt-5.4-mini] Read docs/RFC.md fully. Find ONE feature described in the sp... #31

Merged
Virgil merged 1 commit from main into dev 2026-04-03 20:56:49 +00:00
2 changed files with 28 additions and 1 deletions

View file

@ -68,9 +68,18 @@ type ServiceOptions struct {
TreeRootCheckInterval time.Duration
}
// Options is the documented constructor shape for NewService.
//
// service := dns.NewService(dns.Options{
// Records: map[string]dns.NameRecords{
// "gateway.charon.lthn": {A: []string{"10.10.10.10"}},
// },
// })
type Options = ServiceOptions
// NewService builds a DNS service from cached records and optional discovery hooks.
//
// service := dns.NewService(dns.ServiceOptions{
// service := dns.NewService(dns.Options{
// Records: map[string]dns.NameRecords{
// "gateway.charon.lthn": {A: []string{"10.10.10.10"}},
// },

View file

@ -54,6 +54,24 @@ func TestServiceResolveUsesExactNameBeforeWildcard(t *testing.T) {
}
}
func TestServiceOptionsAliasBuildsService(t *testing.T) {
service := NewService(Options{
Records: map[string]NameRecords{
"gateway.charon.lthn": {
A: []string{"10.10.10.10"},
},
},
})
result, ok := service.ResolveAddress("gateway.charon.lthn")
if !ok {
t.Fatal("expected service constructed from Options alias to resolve")
}
if len(result.Addresses) != 1 || result.Addresses[0] != "10.10.10.10" {
t.Fatalf("unexpected resolve result from Options alias: %#v", result.Addresses)
}
}
func TestServiceResolveUsesMostSpecificWildcard(t *testing.T) {
service := NewService(ServiceOptions{
Records: map[string]NameRecords{