diff --git a/Makefile b/Makefile index 60694ae..4e31388 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ FRONTEND_WEB_SRC := $(shell find cmd/frontend/web/src -type f 2>/dev/null) \ FRONTEND_WEB_DIST := cmd/frontend/web/dist/index.html NATIVE_ARCH := $(shell go env GOARCH) -VERSION := 1.0.0 +VERSION := 1.0.1 COMMIT_HASH := $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown) DATE := $(shell date -u +%Y-%m-%dT%H:%M:%SZ) LDFLAGS := -X '$(MODULE)/cmd.version=$(VERSION)' \ diff --git a/cmd/tester/main.go b/cmd/tester/main.go index f26abf5..d04f2f1 100644 --- a/cmd/tester/main.go +++ b/cmd/tester/main.go @@ -108,7 +108,7 @@ func run() error { } m := Model{ - cfgPath: strings.Join(cfgPaths, ", "), + host: fqdn(), vips: vips, opts: opts, startAt: time.Now(), @@ -158,6 +158,24 @@ func run() error { // deterministic TUI layout: within a file, frontends are visited // in name-sorted order; across files, the first occurrence of each // tuple wins and fixes its slot in the output. +// fqdn returns the system's fully-qualified hostname: gethostname(2) +// via os.Hostname() for the short name, then a CNAME lookup to reach +// the canonical form the resolver would hand back — the same two-step +// dance `hostname -f` performs. Falls back to the short name when the +// resolver has nothing to add, so the TUI header always renders. +func fqdn() string { + h, err := os.Hostname() + if err != nil { + return "unknown" + } + if cname, err := net.LookupCNAME(h); err == nil { + if s := strings.TrimSuffix(cname, "."); s != "" { + return s + } + } + return h +} + func buildVIPsUnion(cfgs []*config.Config, cfgPaths []string, filterRe *regexp.Regexp, opts probeOpts) []*vipState { _ = cfgPaths // reserved for future diagnostics (e.g. which file this tuple came from) type key struct { diff --git a/cmd/tester/model.go b/cmd/tester/model.go index cb0f2b1..e8bb778 100644 --- a/cmd/tester/model.go +++ b/cmd/tester/model.go @@ -75,7 +75,7 @@ type errEvent struct { // probeResultMsg handlers can update rolling/tally without copying // the whole model. type Model struct { - cfgPath string + host string vips []*vipState opts probeOpts startAt time.Time diff --git a/cmd/tester/view.go b/cmd/tester/view.go index 050eaf4..9797083 100644 --- a/cmd/tester/view.go +++ b/cmd/tester/view.go @@ -149,7 +149,7 @@ func (m Model) viewHeader() string { } line := fmt.Sprintf( "maglevt — %s — interval: %s timeout: %s header: %s [%s] uptime: %s", - m.cfgPath, + m.host, m.opts.Interval, m.opts.Timeout, m.opts.Header,