You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
423 B
Go
20 lines
423 B
Go
5 months ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
// parseIPRange parses a string of IP ranges into start and end IP slices
|
||
|
func parseIPRange(input string) ([]string, []string) {
|
||
|
lines := strings.Split(input, "\n")
|
||
|
var srange, erange []string
|
||
|
for _, line := range lines {
|
||
|
parts := strings.Fields(line)
|
||
|
if len(parts) >= 2 {
|
||
|
srange = append(srange, parts[0])
|
||
|
erange = append(erange, parts[1])
|
||
|
}
|
||
|
}
|
||
|
return srange, erange
|
||
|
}
|