2022-04-14 01:36:15 +00:00
|
|
|
package iprange_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"log"
|
|
|
|
|
2024-06-05 17:36:34 +00:00
|
|
|
"gitlab.com/slon/shad-go/iprange"
|
2022-04-14 01:36:15 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func ExampleParseList() {
|
|
|
|
list, err := iprange.ParseList("10.0.0.1, 10.0.0.5-10, 192.168.1.*, 192.168.10.0/24")
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, i := range list {
|
|
|
|
fmt.Println(i)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Output:
|
|
|
|
// {10.0.0.1 10.0.0.1}
|
|
|
|
// {10.0.0.5 10.0.0.10}
|
|
|
|
// {192.168.1.0 192.168.1.255}
|
|
|
|
// {192.168.10.0 192.168.10.255}
|
|
|
|
}
|