cookie is a struct, grab the value for index

This commit is contained in:
Dan Ballard 2020-09-28 10:03:27 -07:00
parent a38c82fd21
commit ec7ad148cf
1 changed files with 4 additions and 3 deletions

View File

@ -69,15 +69,16 @@ func filter(res http.ResponseWriter, req *http.Request, listenPort, proxyPort in
}
//log.Debugf("%v: Request %v %v\n", ip, req.Host, req.URL)
cookie, err := req.Cookie("i_like_gogits")
log.Debugf("ip: %v cookie: %v\n", ip, cookie)
cookieObj, err := req.Cookie("i_like_gogits")
log.Debugf("ip: %v cookie: %v\n", ip, cookieObj)
if err != nil {
pass(res, req, listenPort, proxyPort)
return
}
ips, ok := cookiesToIps.Load(cookie)
cookie := cookieObj.Value
ips, ok := cookiesToIps.Load(cookie)
if !ok {
ips := Ip2LastSeen{ip: time.Now()}
cookiesToIps.Store(cookie, ips)