package server import ( "encoding/json" "housecarl/internal/trace" ) // otherTables lists the tables in an `nft -j list ruleset` other than // Housecarl's ("inet main"). func otherTables(data []byte) []string { var doc struct { Nftables []map[string]json.RawMessage `json:"nftables"` } out := []string{} if json.Unmarshal(data, &doc) != nil { return out } for _, item := range doc.Nftables { raw, ok := item["table"] if !ok { continue } var t struct{ Family, Name string } if json.Unmarshal(raw, &t) == nil && !(t.Family == "inet" && (t.Name == "housecarl" || t.Name == trace.Table)) { out = append(out, t.Family+" "+t.Name) } } return out }