v1.0.0 #1

Merged
kor-elf merged 32 commits from develop into main 2026-03-15 20:36:00 +05:00
Showing only changes of commit 062cb25551 - Show all commits

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)
}