Compare commits

2 Commits

4 changed files with 32 additions and 3 deletions

View File

@@ -8,7 +8,7 @@ import (
)
/**
* An example of how to get a list of bad IP addresses from the service https://dshield.org/
* An example of how to get a list of IP addresses from a service https://dshield.org/
*/
func main() {

View File

@@ -10,7 +10,7 @@ import (
)
/**
* An example of how to get a list of bad IP addresses from the service https://www.projecthoneypot.org/list_of_ips.php
* An example of how to get a list of IP addresses from a service https://www.projecthoneypot.org/list_of_ips.php
*/
type rssItem struct {

View File

@@ -9,7 +9,7 @@ import (
)
/**
* An example of how to get a list of bad IP addresses from the service https://www.spamhaus.org/blocklists/do-not-route-or-peer/
* An example of how to get a list of IP addresses from a service https://www.spamhaus.org/blocklists/do-not-route-or-peer/
*/
type lineJson struct {

29
examples/tor.go Normal file
View File

@@ -0,0 +1,29 @@
package main
import (
"fmt"
"git.kor-elf.net/kor-elf-shield/blocklist"
"git.kor-elf.net/kor-elf-shield/blocklist/parser"
)
/**
* An example of how to get a list of IP addresses from a service https://check.torproject.org/torbulkexitlist
*/
func main() {
url := "https://check.torproject.org/torbulkexitlist"
extract := parser.NewDefaultTextExtract(0, " ")
pars, err := parser.NewText(extract)
if err != nil {
panic(err)
}
// limit 0 - no limit
limit := uint(0)
config := blocklist.NewConfig(limit)
ips, err := blocklist.Get(url, pars, config)
if err != nil {
panic(err)
}
fmt.Println(ips)
}