Example #1
0
func load_gfwrules() {
	fp := filepath.Join(backend_config().DataFolder, "gfwlist.txt")
	reader, err := os.Open(fp)
	if err == nil {
		defer reader.Close()
		backend_context.ruler, err = gfwlist.NewGfwRuler(reader)
	}
	log.Println("gfwlist-load", err, fp)
}
Example #2
0
func main() {
	flag.Parse()
	f, err := os.Open(input)
	if err != nil {
		fmt.Println(err)
	}
	defer f.Close()

	ruler, _ := gfwlist.NewGfwRuler(f)
	if len(*uri) != 0 {
		fmt.Println(ruler.IsBlocked(*uri))
	}
}