fix: keep probe files across hub restarts; phone filter sheet above the tab bar (2.1.2)
CI / Format and vet (push) Successful in 1m4s
CI / Dependency audit (push) Successful in 33s
CI / Tests (Linux, race detector) (push) Successful in 2m10s
Release / Plan (reuse the published image?) (push) Successful in 5s
Release / ci (push) Skipped
Release / Build hub image (amd64) (push) Skipped
Release / Build probe image (amd64) (push) Skipped
Release / Build hub image (arm64) (push) Skipped
Release / Build probe image (arm64) (push) Skipped
Release / Publish tags (hub) (push) Successful in 16s
Release / Publish tags (probe) (push) Successful in 16s
Release / Gitea release (push) Successful in 5s

The hub kept a probe's resolv.conf and containers.map only in memory, so
after a restart the egress lines replayed on reconnect were judged with
the hub's own resolvers (false dns_bypass, hostinger/INC-8). They are now
saved in the node directory and loaded at start.

Phone: the global filter sheet opens above the bottom tab bar, the tab
bar closes it, and the sticky filter bar no longer covers the More menu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas RayanandClaude Opus 5.5 committed 2026-11-16 08:41:28 -03:00
1 parent fb2dfa3fb2
commit 19afd221e2
7 files changed
+89 -6

No files matched your search

+37
View File
@@ -124,6 +124,7 @@ func (sh *shared) newNode(name string, primary bool, rec hub.Probe) (*Node, erro
sh.wg.Add(1)
go func() { defer sh.wg.Done(); n.Enf.Run(sh.ctx) }()
}
n.loadProbeFiles()
if !egressOff(c) {
if err := n.buildEgress(rec.Egress); err != nil {
return nil, err
@@ -189,6 +190,41 @@ func (n *Node) Close() {
}
}
// probeFilePath is where the last copy of a file sent by the probe is kept,
// so that after a hub restart the egress lines replayed by the probe are
// judged with its resolvers and container names before it sends them again.
func (n *Node) probeFilePath(name string) string {
return filepath.Join(n.Dir, "probe-"+name)
}
func (n *Node) loadProbeFiles() {
for _, f := range []struct {
name string
dst *atomic.Pointer[[]byte]
}{{wire.FileContainers, &n.containers}, {wire.FileResolv, &n.resolv}} {
b, err := os.ReadFile(n.probeFilePath(f.name))
if err != nil || len(b) > wire.MaxFileBytes {
continue
}
f.dst.Store(&b)
}
}
func (n *Node) saveProbeFile(name string, data []byte) {
p := n.probeFilePath(name)
if old, err := os.ReadFile(p); err == nil && string(old) == string(data) {
return
}
tmp := p + ".tmp"
if err := os.WriteFile(tmp, data, 0o600); err != nil {
n.sh.log.Warn("probe file not saved", "node", n.name, "file", name, "err", err)
return
}
if err := os.Rename(tmp, p); err != nil {
n.sh.log.Warn("probe file not saved", "node", n.name, "file", name, "err", err)
}
}
func (n *Node) buildEgress(eg hub.Egress) error {
eng, err := newEgressEngine(n.sh.c, n.St, eg, n.Primary)
if err != nil {
@@ -263,6 +299,7 @@ func (n *Node) Apply(b wire.Batch) (int, int) {
default:
continue
}
n.saveProbeFile(f.Name, data)
if e := n.egr.Load(); e != nil {
if f.Name == wire.FileContainers {
e.SetContainers(data)
+29
View File
@@ -0,0 +1,29 @@
package app
import (
"io"
"log/slog"
"testing"
"git.lucasrguerra.dev.br/ciberfauna/urutau/internal/wire"
)
// The files sent by a probe survive a hub restart: without them the egress
// lines the probe replays right after reconnecting were judged with the hub's
// own resolvers (a dns_bypass false positive on the probe's upstream resolver).
func TestProbeFilesSurviveRestart(t *testing.T) {
dir := t.TempDir()
sh := &shared{log: slog.New(slog.NewTextHandler(io.Discard, nil))}
n := &Node{name: "hostinger", Dir: dir, sh: sh}
n.saveProbeFile(wire.FileResolv, []byte("nameserver 153.92.2.6\n"))
n.saveProbeFile(wire.FileContainers, []byte("172.17.0.2 coolify-sentinel\n"))
n2 := &Node{name: "hostinger", Dir: dir, sh: sh}
n2.loadProbeFiles()
if b := n2.resolv.Load(); b == nil || string(*b) != "nameserver 153.92.2.6\n" {
t.Fatalf("resolv.conf not restored: %v", b)
}
if b := n2.containers.Load(); b == nil || string(*b) != "172.17.0.2 coolify-sentinel\n" {
t.Fatalf("containers.map not restored: %v", b)
}
}
+1 -1
View File
@@ -2,4 +2,4 @@ package app
// Version is the release version (SemVer). Release builds may override it with
// -ldflags "-X .../internal/app.Version=...".
var Version = "2.1.1"
var Version = "2.1.2"