Compare commits

2 Commits

2 changed files with 30 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ go get git.kor-elf.net/kor-elf-shield/blocklist
- [Пример получения списка IP адресов от DShield](/examples/dshield.go)
- [Пример получения списка IP адресов от HONEYPOT](/examples/honeypot.go)
- [Пример получения списка IP адресов от Tor](/examples/tor.go)
- [Пример получения списка IP адресов от CIARMY](/examples/ciarmy.go)
## Лицензия

29
examples/ciarmy.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://www.ciarmy.com/#list
*/
func main() {
url := "https://www.ciarmy.com/list/ci-badguys.txt"
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)
}