systemd-resolved: answer with the generated contract's own types (review r1 C-6, C-8)

C-6: import noderesolver (mesh-networking's seat definition) at the zero
version; routes, route, unroute and uplink-names answer with its
RoutesAnswer, RouteAnswer, UnrouteAnswer and UplinkNamesAnswer, never a
map or a parallel struct, and uplink-names' input names is a JSON array
(arrayArg), never a comma- or space-split string.

C-8: the names file write's 15 s is the stated constant
WriteUplinkNamesBound, not an inline literal.

Builds: design 08 sign-in-page §2, §5, §6, §9, DQ-12, C-6, C-8
This commit is contained in:
jochen
2026-11-24 22:00:15 +01:00
parent ae7d0f874b
commit 717f8ec2e5
6 changed files with 121 additions and 45 deletions
@@ -495,12 +495,12 @@ func TestRoutesAnswersUplinkNamesAndMeshResolvers(t *testing.T) {
if err != nil {
t.Fatal(err)
}
un := r.UplinkNamesAnswer(routes)
if names, _ := un["names"].([]string); strings.Join(names, ",") != "check.example" || un["link"] != "wlan0" || un["refused"] != "refused once" {
un := r.UplinkNamesField(routes)
if strings.Join(un.Names, ",") != "check.example" || un.Link != "wlan0" || un.Refused != "refused once" {
t.Errorf("uplink_names is %+v", un)
}
mr := r.MeshResolversAnswer()
if mr["silent"] != true || !mr["since"].(time.Time).Equal(since) {
mr := r.MeshResolversField()
if !mr.Silent || mr.Since != since.UTC().Format(time.RFC3339) {
t.Errorf("mesh_resolvers is %+v", mr)
}
}