refactor(edge): unify dynamic IP detection and prioritize IPv4 reporting

- Align agent, relay, and flared to dynamically resolve IP during heartbeat using the nodeip package (when not manually configured).
- Update GeoIP outbound IP strategy to prefer IPv4 HTTP client lookup using tcp4 dialer and fall back to dual-stack tcp.
- Optimize agent profile fingerprinting to exclude dynamic UptimeSeconds and ReportedAtUnix fields, preventing redundant updates.
- Refactor unit tests to prevent outbound network queries during tests.
This commit is contained in:
ryan
2026-06-22 15:06:39 +08:00
parent 346979344f
commit deb232d840
8 changed files with 84 additions and 6 deletions
+2
View File
@@ -67,6 +67,7 @@ type Config struct {
HeartbeatInterval MillisecondDuration `json:"heartbeat_interval"`
RequestTimeout MillisecondDuration `json:"request_timeout"`
configPath string `json:"-"`
NodeIPConfigured bool `json:"-"`
}
type configFile struct {
@@ -129,6 +130,7 @@ func Load(path string) (*Config, error) {
}
cfg.configPath = path
applyEnvOverrides(cfg)
cfg.NodeIPConfigured = cfg.NodeIP != ""
applyDefaults(cfg, filepath.Dir(path))
if err = validate(cfg); err != nil {
return nil, err