Compare commits
2 Commits
ee0e36b40d
...
e4fc07871b
| Author | SHA1 | Date | |
|---|---|---|---|
|
e4fc07871b
|
|||
|
faedb345df
|
@@ -15,6 +15,7 @@ go get git.kor-elf.net/kor-elf-shield/blocklist
|
||||
- [Пример получения списка IP адресов от CIARMY](/examples/ciarmy.go)
|
||||
- [Пример получения списка IP адресов от Daniel Gerzo (BruteforceBlocker)](/examples/bruteforceblocker.go)
|
||||
- [Пример получения списка IP адресов от Blocklist.de](/examples/blocklist.go)
|
||||
- [Пример получения списка IP адресов от GreenSnow](/examples/greensnow.go)
|
||||
|
||||
## Лицензия
|
||||
|
||||
|
||||
29
examples/greensnow.go
Normal file
29
examples/greensnow.go
Normal 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://greensnow.co/
|
||||
*/
|
||||
|
||||
func main() {
|
||||
url := "https://blocklist.greensnow.co/greensnow.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)
|
||||
}
|
||||
Reference in New Issue
Block a user