declare local var.banTime TIME;

# For demonstration purposes, set the client IP to one that we
# know is in the ban list
set req.http.Fastly-Client-IP = "10.208.204.58";

# Check whether the client's IP is in the ban list
if (table.lookup(ban_dict, req.http.Fastly-Client-IP)) {
  
  # The IP is in the ban list.  Find out when the ban expires
  set var.banTime = std.integer2time(
    std.atoi(
      table.lookup(ban_dict, req.http.Fastly-Client-IP)
    )
  );
  
  # Check if the ban is still in effect, or if it has expired
  if (time.is_after(var.banTime, now)) {
    log "syslog " req.service_id " loggerName :: Ban in effect for " req.http.Fastly-Client-IP;
    error 601 var.banTime;
  }
  log "syslog " req.service_id " loggerName :: Ban for " req.http.Fastly-Client-IP " expired at " var.banTime ", allowing access";
} else {
  
  # The IP is NOT in the ban list
  log "syslog " req.service_id " loggerName :: " req.http.Fastly-Client-IP " is not banned.";
}