package main import ( "fmt" "log" "net/http" ) //HTTPFlow is a type containg all the data we need. type HTTPFlow struct { request *http.Request response *http.Response sensitivity float64 // value who triggers decisions seniority int64 } //DebugLog tells if logs are in debug mode or not var DebugLog bool //ProxyFlow represents our flow var ProxyFlow HTTPFlow //Classifier is our bayesian classifier var Classifier *ByClassifier //BlockMessage is the messgae we return when blocking var BlockMessage string //Maturity is the minimal amount of request , needed to say Zardoz has learnt enough var Maturity int64 func init() { Classifier = new(ByClassifier) Classifier.enroll() ProxyFlow.sensitivity = 0.5 ProxyFlow.seniority = 0 bl, err := Asset("assets/message.txt") if err != nil { log.Println("Cannot marshal asset error message!!") BlockMessage = "" } else { BlockMessage = fmt.Sprintf("%s", bl) } }