Add Country Code Support, power by cloudflare

This commit is contained in:
George Shammas
2015-03-04 08:15:24 -05:00
parent 2373062a39
commit c4b8b29681
2 changed files with 7 additions and 0 deletions

View File

@@ -70,6 +70,7 @@ func mainHandler(c *gin.Context) {
c.Set("mime", c.Request.Header.Get("Accept"))
c.Set("referer", c.Request.Header.Get("Referer"))
c.Set("forwarded", c.Request.Header.Get("X-Forwarded-For"))
c.Set("country_code", c.Request.Header.Get("CF-IPCountry"))
// Only lookup hostname if the results are going to need it.
if stringInSlice(fields[0], []string{"", "all", "host"}) {