Add commented examples for excluding IPs/subnets in blocklist configurations across use cases
This commit is contained in:
@@ -24,6 +24,18 @@ func main() {
|
||||
limit := uint(0)
|
||||
config := blocklist.NewConfig(limit)
|
||||
|
||||
// If you need to exclude an IP address or subnet
|
||||
//excludeIPs := []string{
|
||||
// "172.18.0.2",
|
||||
// //"172.18.0.0/24",
|
||||
// //"172.18.0.0-172.18.0.255",
|
||||
//}
|
||||
//exclusionChecker, err := parser.NewExclusionChecker(excludeIPs)
|
||||
//if err != nil {
|
||||
// panic(err)
|
||||
//}
|
||||
//config := blocklist.NewConfigWithExclusionChecker(limit, exclusionChecker)
|
||||
|
||||
// Get IPv4 and IPv6 addresses in one list
|
||||
ips, err := blocklist.Get(url, pars, config)
|
||||
if err != nil {
|
||||
@@ -54,6 +66,18 @@ func main() {
|
||||
limit := uint(0)
|
||||
config := blocklist.NewConfig(limit)
|
||||
|
||||
// If you need to exclude an IP address or subnet
|
||||
//excludeIPs := []string{
|
||||
// "172.18.0.2",
|
||||
// //"172.18.0.0/24",
|
||||
// //"172.18.0.0-172.18.0.255",
|
||||
//}
|
||||
//exclusionChecker, err := parser.NewExclusionChecker(excludeIPs)
|
||||
//if err != nil {
|
||||
// panic(err)
|
||||
//}
|
||||
//config := blocklist.NewConfigWithExclusionChecker(limit, exclusionChecker)
|
||||
|
||||
// Get IPv4 and IPv6 addresses in one list
|
||||
ips, err := blocklist.Get(url, pars, config)
|
||||
if err != nil {
|
||||
|
||||
@@ -22,6 +22,18 @@ func main() {
|
||||
limit := uint(0)
|
||||
config := blocklist.NewConfig(limit)
|
||||
|
||||
// If you need to exclude an IP address or subnet
|
||||
//excludeIPs := []string{
|
||||
// "172.18.0.2",
|
||||
// //"172.18.0.0/24",
|
||||
// //"172.18.0.0-172.18.0.255",
|
||||
//}
|
||||
//exclusionChecker, err := parser.NewExclusionChecker(excludeIPs)
|
||||
//if err != nil {
|
||||
// panic(err)
|
||||
//}
|
||||
//config := blocklist.NewConfigWithExclusionChecker(limit, exclusionChecker)
|
||||
|
||||
// Get IPv4 and IPv6 addresses in one list
|
||||
ips, err := blocklist.Get(url, pars, config)
|
||||
if err != nil {
|
||||
|
||||
@@ -22,6 +22,18 @@ func main() {
|
||||
limit := uint(0)
|
||||
config := blocklist.NewConfig(limit)
|
||||
|
||||
// If you need to exclude an IP address or subnet
|
||||
//excludeIPs := []string{
|
||||
// "172.18.0.2",
|
||||
// //"172.18.0.0/24",
|
||||
// //"172.18.0.0-172.18.0.255",
|
||||
//}
|
||||
//exclusionChecker, err := parser.NewExclusionChecker(excludeIPs)
|
||||
//if err != nil {
|
||||
// panic(err)
|
||||
//}
|
||||
//config := blocklist.NewConfigWithExclusionChecker(limit, exclusionChecker)
|
||||
|
||||
// Get IPv4 and IPv6 addresses in one list
|
||||
ips, err := blocklist.Get(url, pars, config)
|
||||
if err != nil {
|
||||
|
||||
@@ -22,6 +22,18 @@ func main() {
|
||||
limit := uint(0)
|
||||
config := blocklist.NewConfig(limit)
|
||||
|
||||
// If you need to exclude an IP address or subnet
|
||||
//excludeIPs := []string{
|
||||
// "172.18.0.2",
|
||||
// //"172.18.0.0/24",
|
||||
// //"172.18.0.0-172.18.0.255",
|
||||
//}
|
||||
//exclusionChecker, err := parser.NewExclusionChecker(excludeIPs)
|
||||
//if err != nil {
|
||||
// panic(err)
|
||||
//}
|
||||
//config := blocklist.NewConfigWithExclusionChecker(limit, exclusionChecker)
|
||||
|
||||
// Get IPv4 and IPv6 addresses in one list
|
||||
ips, err := blocklist.Get(url, pars, config)
|
||||
if err != nil {
|
||||
@@ -51,6 +63,20 @@ func main() {
|
||||
limit := uint(0)
|
||||
config := blocklist.NewConfigWithValidator(limit, &parser.IPRangeValidator{})
|
||||
|
||||
// If you need to exclude an IP address or subnet
|
||||
//excludeIPs := []string{
|
||||
// "172.18.0.2",
|
||||
// //"172.18.0.0/24",
|
||||
// //"172.18.0.0-172.18.0.255",
|
||||
//}
|
||||
//exclusionChecker, err := parser.NewExclusionChecker(excludeIPs)
|
||||
//if err != nil {
|
||||
// panic(err)
|
||||
//}
|
||||
//config := blocklist.NewConfigWithValidator(limit, &parser.IPRangeValidator{
|
||||
// ExclusionChecker: exclusionChecker,
|
||||
//})
|
||||
|
||||
// Get IPv4 and IPv6 addresses in one list
|
||||
ips, err := blocklist.Get(url, pars, config)
|
||||
if err != nil {
|
||||
|
||||
@@ -22,6 +22,18 @@ func main() {
|
||||
limit := uint(0)
|
||||
config := blocklist.NewConfig(limit)
|
||||
|
||||
// If you need to exclude an IP address or subnet
|
||||
//excludeIPs := []string{
|
||||
// "172.18.0.2",
|
||||
// //"172.18.0.0/24",
|
||||
// //"172.18.0.0-172.18.0.255",
|
||||
//}
|
||||
//exclusionChecker, err := parser.NewExclusionChecker(excludeIPs)
|
||||
//if err != nil {
|
||||
// panic(err)
|
||||
//}
|
||||
//config := blocklist.NewConfigWithExclusionChecker(limit, exclusionChecker)
|
||||
|
||||
// Get IPv4 and IPv6 addresses in one list
|
||||
ips, err := blocklist.Get(url, pars, config)
|
||||
if err != nil {
|
||||
|
||||
@@ -46,6 +46,18 @@ func main() {
|
||||
limit := uint(0)
|
||||
config := blocklist.NewConfig(limit)
|
||||
|
||||
// If you need to exclude an IP address or subnet
|
||||
//excludeIPs := []string{
|
||||
// "172.18.0.2",
|
||||
// //"172.18.0.0/24",
|
||||
// //"172.18.0.0-172.18.0.255",
|
||||
//}
|
||||
//exclusionChecker, err := parser.NewExclusionChecker(excludeIPs)
|
||||
//if err != nil {
|
||||
// panic(err)
|
||||
//}
|
||||
//config := blocklist.NewConfigWithExclusionChecker(limit, exclusionChecker)
|
||||
|
||||
// Get IPv4 and IPv6 addresses in one list
|
||||
ips, err := blocklist.Get(url, pars, config)
|
||||
if err != nil {
|
||||
|
||||
@@ -33,6 +33,18 @@ func main() {
|
||||
limit := uint(0)
|
||||
config := blocklist.NewConfig(limit)
|
||||
|
||||
// If you need to exclude an IP address or subnet
|
||||
//excludeIPs := []string{
|
||||
// "172.18.0.2",
|
||||
// //"172.18.0.0/24",
|
||||
// //"172.18.0.0-172.18.0.255",
|
||||
//}
|
||||
//exclusionChecker, err := parser.NewExclusionChecker(excludeIPs)
|
||||
//if err != nil {
|
||||
// panic(err)
|
||||
//}
|
||||
//config := blocklist.NewConfigWithExclusionChecker(limit, exclusionChecker)
|
||||
|
||||
// Get IPv4 and IPv6 addresses in one list
|
||||
ips, err := blocklist.Get(url, pars, config)
|
||||
if err != nil {
|
||||
|
||||
@@ -22,6 +22,19 @@ func main() {
|
||||
// limit 0 - no limit
|
||||
limit := uint(0)
|
||||
config := blocklist.NewConfig(limit)
|
||||
|
||||
// If you need to exclude an IP address or subnet
|
||||
//excludeIPs := []string{
|
||||
// "172.18.0.2",
|
||||
// //"172.18.0.0/24",
|
||||
// //"172.18.0.0-172.18.0.255",
|
||||
//}
|
||||
//exclusionChecker, err := parser.NewExclusionChecker(excludeIPs)
|
||||
//if err != nil {
|
||||
// panic(err)
|
||||
//}
|
||||
//config := blocklist.NewConfigWithExclusionChecker(limit, exclusionChecker)
|
||||
|
||||
configZip := blocklist.NewConfigZip(config)
|
||||
|
||||
// Get IPv4 and IPv6 addresses in one list
|
||||
|
||||
@@ -22,6 +22,18 @@ func main() {
|
||||
limit := uint(0)
|
||||
config := blocklist.NewConfig(limit)
|
||||
|
||||
// If you need to exclude an IP address or subnet
|
||||
//excludeIPs := []string{
|
||||
// "172.18.0.2",
|
||||
// //"172.18.0.0/24",
|
||||
// //"172.18.0.0-172.18.0.255",
|
||||
//}
|
||||
//exclusionChecker, err := parser.NewExclusionChecker(excludeIPs)
|
||||
//if err != nil {
|
||||
// panic(err)
|
||||
//}
|
||||
//config := blocklist.NewConfigWithExclusionChecker(limit, exclusionChecker)
|
||||
|
||||
// Get IPv4 and IPv6 addresses in one list
|
||||
ips, err := blocklist.Get(url, pars, config)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user