package storage import ( "context" "database/sql" "net/netip" "tug/internal/platform/origin" ) func auditAddress(ctx context.Context, explicit netip.Addr) netip.Addr { a := explicit if !a.IsValid() { a = origin.Of(ctx).Addr } if !a.IsValid() { return netip.Addr{} } return a.Unmap().WithZone("") } func scanAddress(s sql.NullString) netip.Addr { if !s.Valid { return netip.Addr{} } a, err := netip.ParseAddr(s.String) if err != nil { return netip.Addr{} } return a }