v1
Test / test (push) Successful in 3m36s
Release / release (push) Successful in 7m31s

This commit is contained in:
Sebastian Unterschütz committed 2026-11-17 19:00:44 +01:00
commit 8d4915543e
132 files changed
+20628

No files matched your search

+23
View File
@@ -0,0 +1,23 @@
package resolver
import (
"context"
"git.zb-server.de/Sebi/ssh-netbox-wrapper/internal/netbox"
)
// PrimaryIPStrategy returns the primary IP configured in NetBox.
// Prefers IPv4, falls back to IPv6.
type PrimaryIPStrategy struct{}
func (s *PrimaryIPStrategy) Name() string { return "primary_ip" }
func (s *PrimaryIPStrategy) Resolve(_ context.Context, entry *netbox.HostEntry, _ *netbox.Client) (string, error) {
if entry.PrimaryIP4 != "" {
return entry.PrimaryIP4, nil
}
if entry.PrimaryIP6 != "" {
return entry.PrimaryIP6, nil
}
return "", ErrNoIP
}