Take the suffix of internal names from the Input and never the environment: Input.InternalSuffix and a local internal-name helper, so the package doc is true (review round 1, finding 5). The test failed first; the suite is 1257 tests in 1.04 s

This commit is contained in:
2026-10-20 07:02:58 +00:00
parent 892a3955b7
commit 3eadff23eb
4 changed files with 47 additions and 8 deletions
+14 -1
View File
@@ -37,6 +37,19 @@ func (c *composer) say(format string, args ...any) {
c.said = append(c.said, line)
}
// suffix is what the mesh's internal names end in: the Input's, and overlay.DefaultSuffix when it gives none. The package never calls
// overlay.Suffix or overlay.InternalName, which read the environment, so the assigner and the controller compose the same names
// from the same Input.
func (c *composer) suffix() string {
if v := strings.TrimPrefix(strings.TrimSpace(c.in.InternalSuffix), "."); v != "" {
return v
}
return overlay.DefaultSuffix
}
// internalName is a node's name inside the mesh.
func (c *composer) internalName(node string) string { return node + "." + c.suffix() }
// overlayRange is the range the mesh allocates node addresses from: the adopted tunnel's first (novox/hq ADR 0105),
// then the range genesis was told, then the default.
func (c *composer) overlayRange() string {
@@ -203,7 +216,7 @@ func (c *composer) whereEveryoneIs() (map[string]string, error) {
}
out := map[string]string{}
for _, p := range c.onTheNetwork() {
out[p.Name] = overlay.InternalName(p.Name)
out[p.Name] = c.internalName(p.Name)
}
return out, nil
}