MCPcopy Create free account
hub / github.com/encodeous/nylon / parseSymbolList

Function parseSymbolList

state/config.go:119–137  ·  view source on GitHub ↗
(s string, validSymbols []string)

Source from the content-addressed store, hash-verified

117}
118
119func 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
139func MakeSet(prefix []netip.Prefix) *netipx.IPSet {
140 builder := netipx.IPSetBuilder{}

Callers 1

ParseGraphFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected