Browse Source

Improving token grabbing and stats

Loweel 4 years ago
parent
commit
9c76a6581b
2 changed files with 5 additions and 5 deletions
  1. 3 3
      classifier.go
  2. 2 2
      handler.go

+ 3 - 3
classifier.go

@@ -29,7 +29,7 @@ func passAndLearn(resp *http.Response) error {
 		resp.Header.Set("Content-Encoding", "none")
 		log.Println("Filing inside bad class")
 		feedRequest(req, "BAD")
-		ControPlane.StatsTokens <- "LEARN-BAD"
+		ControPlane.StatsTokens <- "DOWNGRADE"
 	default:
 		log.Println("Filing inside Good Class: ", resp.StatusCode)
 		feedRequest(req, "GOOD")
@@ -59,7 +59,7 @@ func blockAndlearn(resp *http.Response) error {
 		feedRequest(req, "BAD")
 	default:
 		log.Println("Filing inside Good Class: ", resp.StatusCode)
-		ControPlane.StatsTokens <- "LEARN-GOOD"
+		ControPlane.StatsTokens <- "UPGRADED"
 		feedRequest(req, "GOOD")
 	}
 
@@ -69,7 +69,7 @@ func blockAndlearn(resp *http.Response) error {
 
 func sanitizeHeaders(s string) string {
 
-	re := regexp.MustCompile(`[[:alnum:]]{4,32}|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|([0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12})`)
+	re := regexp.MustCompile(`[[:alnum:]]{6,32}|[[:alpha:]]{4,32}|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})|([0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12})`)
 	matched := re.FindAllString(s, -1)
 
 	uMatched := Unique(matched)

+ 2 - 2
handler.go

@@ -50,7 +50,7 @@ func quadrant(p map[string]float64) string {
 
 	if ProxyFlow.seniority < Maturity {
 		log.Println("Seniority too low. Waiting.")
-		return "YOUNG"
+		return "PASSLEARN"
 	}
 
 	if sure {
@@ -75,6 +75,6 @@ func quadrant(p map[string]float64) string {
 
 	}
 
-	return "MEH"
+	return "PASSLEARN"
 
 }