in pkg/mock/spot/spot.go [51:72]
func Handler(res http.ResponseWriter, req *http.Request) {
// specify negative value to disable this feature
if c.MockIPCount >= 0 {
// req.RemoteAddr is formatted as IP:port
requestIP := strings.Split(req.RemoteAddr, ":")[0]
if !eligibleIPs[requestIP] {
if len(eligibleIPs) < c.MockIPCount {
eligibleIPs[requestIP] = true
} else {
log.Printf("Requesting IP %s is not eligible for Spot ITN or Rebalance Recommendation because the max number of IPs configured (%d) has been reached.\n", requestIP, c.MockIPCount)
server.ReturnNotFoundResponse(res)
return
}
}
}
switch req.URL.Path {
case instanceActionPath, terminationTimePath:
handleSpotITN(res, req)
case rebalanceRecPath:
handleRebalance(res, req)
}
}