Exemple #1
0
func main() {
	// Set the files to be made available under http://gateway/
	http.Handle("/", http.FileServer(http.Dir(os.Getenv("HOME")+"/Sites")))

	icap.HandleFunc("/golang", toGolang)
	icap.ListenAndServe(":1344", icap.HandlerFunc(toGolang))
}
func main() {
	fmt.Fprintln(os.Stderr, "Starting Shadower WAF connector ICAP service :D")

	if *debug {
		fmt.Fprintln(os.Stderr, "Config Variables:")
		fmt.Fprintln(os.Stderr, "Debug: => "+strconv.FormatBool(*debug))
		fmt.Fprintln(os.Stderr, "Listen Address: => "+*address)
		fmt.Fprintln(os.Stderr, "Maximum number of Connections: => "+*maxConnections)

	}

	shadowServer = shadowd.ShadowdConn{ServerAddr: *shadowd_addr,
		ReadBody:   false, // Disabled due to the structure of the ICAP service that doesn't implement bodies hanlding properly.
		ProfileId:  *shadowd_profileid,
		Logfile:    "",
		Debug:      *shadowd_debug,
		ProfileKey: *shadowd_profilekey,
	}

	icap.HandleFunc("/shadower/", toShadowD)
	icap.HandleFunc("/", defaultIcap)
	err := icap.ListenAndServe(*address, nil)
	panic(err)
}