Admit a port from the machine's own local network, and never a public subnet (issue 154, ADR 0340)
mesh/delivery-group group fix/154-local-network checking: 0 of 2 member(s) ready
mesh/merge-gate out of date: judged against trunk 1826b68a22b5, the trunk is now 404b4409e70e; judged again on a recheck or when it is merged
mesh/repo-check out of date: judged against trunk 1826b68a22b5, the trunk is now 404b4409e70e; judged again on a recheck or when it is merged
mesh/delivery superseded: a newer head of the same pull request
mesh/delivery-group group fix/154-local-network checking: 0 of 2 member(s) ready
mesh/merge-gate out of date: judged against trunk 1826b68a22b5, the trunk is now 404b4409e70e; judged again on a recheck or when it is merged
mesh/repo-check out of date: judged against trunk 1826b68a22b5, the trunk is now 404b4409e70e; judged again on a recheck or when it is merged
mesh/delivery superseded: a newer head of the same pull request
A local service could only be declared public, which says the internet. local-network is a source and a reach: the private network and the private networks the machine reported on a link facing outside, judged here, shown by plan and node, and said in the rule set when there are none.
This commit is contained in:
@@ -36,7 +36,16 @@ type MadeOf struct {
|
||||
BootedAt *time.Time `json:"booted_at"`
|
||||
Timezone string `json:"timezone"`
|
||||
Filesystems []MountedFilesystem `json:"filesystems"`
|
||||
Unknown map[string]string `json:"unknown"`
|
||||
// Networks is every network the machine is directly attached to on a link facing outside it, as
|
||||
// link and network (novox/hq ADR 0340 §7): what a port reached from `local-network` resolves from.
|
||||
Networks []AttachedNetwork `json:"networks"`
|
||||
Unknown map[string]string `json:"unknown"`
|
||||
}
|
||||
|
||||
// AttachedNetwork is one network a machine said it is attached to, and the link it is on.
|
||||
type AttachedNetwork struct {
|
||||
Link string `json:"link"`
|
||||
Network string `json:"network"`
|
||||
}
|
||||
|
||||
// MountedFilesystem is one local filesystem a machine has mounted.
|
||||
|
||||
@@ -40,3 +40,18 @@ func TestAProfileWithoutTheFactsIsAnOlderNodeEngineNotNothing(t *testing.T) {
|
||||
t.Error("a node that never reported read as having reported")
|
||||
}
|
||||
}
|
||||
|
||||
// The networks a machine is attached to (novox/hq ADR 0340 §7), in the node-engine's words: what a port
|
||||
// reached from `local-network` resolves from.
|
||||
func TestAMachinesAttachedNetworksAreRead(t *testing.T) {
|
||||
a, had, err := machineFrom([]byte(`{"architecture":"amd64","kernel":"linux",
|
||||
"machine":{"observed_at":"2026-10-13T09:00:00Z",
|
||||
"networks":[{"link":"eth0","network":"192.168.1.0/24"},{"link":"eth1","network":"203.0.113.0/24"}]}}`))
|
||||
if err != nil || !had || a.Machine == nil {
|
||||
t.Fatalf("%+v had %v err %v", a, had, err)
|
||||
}
|
||||
n := a.Machine.Networks
|
||||
if len(n) != 2 || n[0].Link != "eth0" || n[0].Network != "192.168.1.0/24" || n[1].Network != "203.0.113.0/24" {
|
||||
t.Fatalf("networks read as %+v", n)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user