| 117 | } |
| 118 | |
| 119 | func parseSymbolList(s string, validSymbols []string) ([]string, error) { |
| 120 | spl := strings.Split(strings.TrimSpace(s), ",") |
| 121 | line := make([]string, 0) |
| 122 | for _, s := range spl { |
| 123 | x := strings.TrimSpace(s) |
| 124 | if x == "" { |
| 125 | continue |
| 126 | } |
| 127 | if !slices.Contains(validSymbols, x) { |
| 128 | return nil, fmt.Errorf(`invalid graph: %s is not a valid node/group`, x) |
| 129 | } |
| 130 | line = append(line, x) |
| 131 | } |
| 132 | if len(line) == 0 { |
| 133 | return nil, fmt.Errorf(`invalid graph: node/group list must not be empty`) |
| 134 | } |
| 135 | slices.Sort(line) |
| 136 | return line, nil |
| 137 | } |
| 138 | |
| 139 | func MakeSet(prefix []netip.Prefix) *netipx.IPSet { |
| 140 | builder := netipx.IPSetBuilder{} |