Skip to content

Commit d3d66e4

Browse files
committed
feat: agent reports public IPv6 (-public-ip6) for DDNS
1 parent 28a88f3 commit d3d66e4

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

cmd/lattice-agent/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ type agentConfig struct {
3030
Interval time.Duration
3131
AllowExec bool
3232
PublicIP string
33+
PublicIPv6 string
3334
WireGuardIP string
3435
}
3536

@@ -40,7 +41,8 @@ func main() {
4041
flag.StringVar(&cfg.Token, "token", os.Getenv("LATTICE_NODE_TOKEN"), "node enrollment token")
4142
flag.DurationVar(&cfg.Interval, "interval", 10*time.Second, "metrics interval")
4243
flag.BoolVar(&cfg.AllowExec, "allow-exec", os.Getenv("LATTICE_AGENT_ALLOW_EXEC") == "1", "allow bounded task execution")
43-
flag.StringVar(&cfg.PublicIP, "public-ip", os.Getenv("LATTICE_PUBLIC_IP"), "public IP metadata")
44+
flag.StringVar(&cfg.PublicIP, "public-ip", os.Getenv("LATTICE_PUBLIC_IP"), "public IPv4 metadata (server observes source IP if empty)")
45+
flag.StringVar(&cfg.PublicIPv6, "public-ip6", os.Getenv("LATTICE_PUBLIC_IP6"), "public IPv6 metadata")
4446
flag.StringVar(&cfg.WireGuardIP, "wg-ip", os.Getenv("LATTICE_WG_IP"), "WireGuard IP metadata")
4547
flag.Parse()
4648
if cfg.NodeID == "" || cfg.Token == "" {
@@ -52,6 +54,7 @@ func main() {
5254
"token": cfg.Token,
5355
"version": version,
5456
"public_ip": cfg.PublicIP,
57+
"public_ipv6": cfg.PublicIPv6,
5558
"wireguard_ip": cfg.WireGuardIP,
5659
}, nil); err != nil {
5760
log.Fatalf("hello failed: %v", err)
@@ -78,6 +81,7 @@ func reportMetrics(cfg agentConfig) error {
7881
"token": cfg.Token,
7982
"version": version,
8083
"public_ip": cfg.PublicIP,
84+
"public_ipv6": cfg.PublicIPv6,
8185
"wireguard_ip": cfg.WireGuardIP,
8286
"metrics": metrics.Collect(),
8387
}, nil)

0 commit comments

Comments
 (0)