output enhancements
This commit is contained in:
parent
c11523c0d5
commit
96191cac83
4
main.go
4
main.go
@ -28,7 +28,6 @@ func main() {
|
|||||||
}
|
}
|
||||||
blockListName := os.Args[1]
|
blockListName := os.Args[1]
|
||||||
jsonListFile := os.Args[2]
|
jsonListFile := os.Args[2]
|
||||||
fmt.Printf("generating blocklist %s\n", blockListName)
|
|
||||||
|
|
||||||
// Load blocklist config file
|
// Load blocklist config file
|
||||||
countries, err := readJsonListFile(jsonListFile)
|
countries, err := readJsonListFile(jsonListFile)
|
||||||
@ -38,6 +37,7 @@ func main() {
|
|||||||
|
|
||||||
// Download up to date geoip CIDR data
|
// Download up to date geoip CIDR data
|
||||||
for i := range countries {
|
for i := range countries {
|
||||||
|
fmt.Println("downloading cidr list for country: ", countries[i].Name)
|
||||||
countries[i].v4Addresses, err = downloadAddressList(countries[i].Url)
|
countries[i].v4Addresses, err = downloadAddressList(countries[i].Url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("failed to download address list for county'%s': %v", countries[i].Name, err)
|
log.Fatalf("failed to download address list for county'%s': %v", countries[i].Name, err)
|
||||||
@ -45,10 +45,12 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generate mikrotik block list
|
// Generate mikrotik block list
|
||||||
|
fmt.Printf("generating blocklist %s.rsc\n", blockListName)
|
||||||
err = generateOutput(countries, blockListName)
|
err = generateOutput(countries, blockListName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("failed to generate output file: %v", err)
|
log.Fatalf("failed to generate output file: %v", err)
|
||||||
}
|
}
|
||||||
|
fmt.Printf("\n\nCopy the file the router, then import the address list\n\n\t/import %s.rsc\n", blockListName)
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateOutput(countries []Country, blockListName string) error {
|
func generateOutput(countries []Country, blockListName string) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user