New reverse zone: pick from the networks your records use, sized around them

The Zones page's New reverse zone lists every network the records use without a reverse zone, in every view, also where nothing is suggested (suggestions off, dismissed, public views), marked. Picking one fills in the network and view; size buttons (/48 /56 /64 /128, /16 /24 /32) re-mask it around a record's address, so a /48 becomes the records' own /64. Fill stays on. jarl zone suggest-reverse --all [--view V]; GET /reverse-zones/suggestions?all=1&view=.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
adamandClaude Opus 5.5 committed 2026-10-13 11:20:03 +01:00
1 parent b1719ce362
commit 304c89dba4
12 files changed
+228 -31

No files matched your search

+33 -7
View File
@@ -1201,13 +1201,14 @@ type reverseSuggestion struct {
Prefix string `json:"prefix"`
Zone string `json:"zone"`
Group string `json:"group"`
Hidden string `json:"hidden"`
Why string `json:"why"`
Fill int `json:"fill"`
Samples []string `json:"samples"`
}
func zoneSuggestReverseCmd() *cobra.Command {
var create bool
var create, all bool
var dismiss, undismiss, view string
cmd := &cobra.Command{
Use: "suggest-reverse [--create] [--dismiss NETWORK --view V]",
@@ -1224,11 +1225,19 @@ lack for the addresses of their A and AAAA records, in two groups:
changeset; create a public one with 'jarl zone create NETWORK --view V
--fill'. --dismiss hides a suggestion for good (--undismiss shows it
again). A view can stop suggestions: jarl view update V
--reverse-suggestions=false (docs/reverse.md).`,
--reverse-suggestions=false (docs/reverse.md).
--all lists every network the views' records use without a reverse zone,
also where nothing is suggested unasked (a view with suggestions off, a
dismissed network, a public view), to create one by hand; --view narrows
the list to one view. Change the size as you need: a /48 suggested for
IPv6 can be created as a /56 or /64 instead.`,
Example: ` jarl zone suggest-reverse
jarl zone suggest-reverse --create
jarl zone create 139.144.144.154/32 --view internal --fill
jarl zone suggest-reverse --dismiss 185.199.108.153/32 --view internal`,
jarl zone suggest-reverse --dismiss 185.199.108.153/32 --view internal
jarl zone suggest-reverse --all --view vps
jarl zone create 2a02:8013:7f3d::/48 --view internal --fill`,
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
c, err := newClient()
@@ -1246,8 +1255,15 @@ again). A view can stop suggestions: jarl view update V
}
return report(resp)
}
if create && (all || view != "") {
return fmt.Errorf("--create creates the suggestions that are yours; create others one by one: jarl zone create NETWORK --view VIEW --fill")
}
qv := q("view", view)
if all {
qv.Set("all", "1")
}
var sugg []reverseSuggestion
if err := c.Get(ctx(), "/reverse-zones/suggestions", nil, &sugg); err != nil {
if err := c.Get(ctx(), "/reverse-zones/suggestions", qv, &sugg); err != nil {
return err
}
if !create {
@@ -1256,13 +1272,22 @@ again). A view can stop suggestions: jarl view update V
fmt.Fprintln(w, "No reverse zones missing.")
return
}
fmt.Fprintln(w, "GROUP\tVIEW\tNETWORK\tZONE\tPTRS\tFOR EXAMPLE")
head := "GROUP\tVIEW\tNETWORK\tZONE\tPTRS\tFOR EXAMPLE"
if all {
head = "GROUP\tVIEW\tNETWORK\tZONE\tPTRS\tHIDDEN\tFOR EXAMPLE"
}
fmt.Fprintln(w, head)
for _, s := range sugg {
v := s.View
if v == "" {
v = "-"
}
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%d\t%s\n", s.Group, v, s.Prefix, s.Zone, s.Fill, strings.Join(s.Samples, ", "))
cols := []string{s.Group, v, s.Prefix, s.Zone, fmt.Sprint(s.Fill)}
if all {
cols = append(cols, orDash(s.Hidden))
}
cols = append(cols, strings.Join(s.Samples, ", "))
fmt.Fprintln(w, strings.Join(cols, "\t"))
}
fmt.Fprintln(w, "\nCreate yours, filled: jarl zone suggest-reverse --create. A public one only if the address is yours:\njarl zone create NETWORK --view VIEW --fill (or hide it: --dismiss NETWORK --view VIEW).")
})
@@ -1292,6 +1317,7 @@ again). A view can stop suggestions: jarl view update V
cmd.Flags().BoolVar(&create, "create", false, "create the ones that are yours, filled with PTR records")
cmd.Flags().StringVar(&dismiss, "dismiss", "", "hide the suggestion for this network")
cmd.Flags().StringVar(&undismiss, "undismiss", "", "show a dismissed suggestion again")
cmd.Flags().StringVar(&view, "view", "", "with --dismiss/--undismiss: the suggestion's view")
cmd.Flags().StringVar(&view, "view", "", "only this view; with --dismiss/--undismiss: the suggestion's view")
cmd.Flags().BoolVar(&all, "all", false, "also networks not suggested unasked (suggestions off, dismissed, public views)")
return cmd
}