forked from cornoctopus/antifilter
-
Notifications
You must be signed in to change notification settings - Fork 7
/
main.go
41 lines (33 loc) · 815 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// GeoIP generator
//
// Before running this file, the GeoIP database must be downloaded and present.
// To download GeoIP database: https://dev.maxmind.com/geoip/geoip2/geolite2/
// Inside you will find block files for IPv4 and IPv6 and country code mapping.
package main
import (
"flag"
"log"
"github.com/v2fly/geoip/lib"
)
var (
list = flag.Bool("l", false, "List all available input and output formats")
configFile = flag.String("c", "config.json", "Path to the config file")
)
func main() {
flag.Parse()
if *list {
lib.ListInputConverter()
lib.ListOutputConverter()
return
}
instance, err := lib.NewInstance()
if err != nil {
log.Fatal(err)
}
if err := instance.Init(*configFile); err != nil {
log.Fatal(err)
}
if err := instance.Run(); err != nil {
log.Fatal(err)
}
}