From b38d55de45a38c609c4b3b21d6a83631b1e62732 Mon Sep 17 00:00:00 2001 From: Marvin Blum Date: Fri, 1 Jul 2022 20:03:45 +0200 Subject: [PATCH] Removed IP headers, updated dependencies. --- CHANGELOG.md | 5 +++++ client.go | 20 ++++---------------- go.mod | 3 +-- go.sum | 5 +++++ types.go | 4 ---- 5 files changed, 15 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cc4e7f0..0222ebc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 1.8.0 + +* removed IP headers +* updated dependencies + ## 1.7.1 * added single access token that don't require to query an access token using oAuth diff --git a/client.go b/client.go index 14a61cc..4bea02c 100644 --- a/client.go +++ b/client.go @@ -89,10 +89,6 @@ type HitOptions struct { Hostname string URL string IP string - CFConnectingIP string - XForwardedFor string - Forwarded string - XRealIP string UserAgent string AcceptLanguage string Title string @@ -190,14 +186,10 @@ func (client *Client) SessionWithOptions(r *http.Request, options *HitOptions) e } return client.performPost(client.baseURL+sessionEndpoint, &Hit{ - Hostname: client.hostname, - URL: r.URL.String(), - IP: r.RemoteAddr, - CFConnectingIP: r.Header.Get("CF-Connecting-IP"), - XForwardedFor: r.Header.Get("X-Forwarded-For"), - Forwarded: r.Header.Get("Forwarded"), - XRealIP: r.Header.Get("X-Real-IP"), - UserAgent: r.Header.Get("User-Agent"), + Hostname: client.hostname, + URL: r.URL.String(), + IP: r.RemoteAddr, + UserAgent: r.Header.Get("User-Agent"), }, requestRetries) } @@ -551,10 +543,6 @@ func (client *Client) getHit(r *http.Request, options *HitOptions) Hit { Hostname: client.selectField(options.Hostname, client.hostname), URL: client.selectField(options.URL, r.URL.String()), IP: client.selectField(options.IP, r.RemoteAddr), - CFConnectingIP: client.selectField(options.CFConnectingIP, r.Header.Get("CF-Connecting-IP")), - XForwardedFor: client.selectField(options.XForwardedFor, r.Header.Get("X-Forwarded-For")), - Forwarded: client.selectField(options.Forwarded, r.Header.Get("Forwarded")), - XRealIP: client.selectField(options.XRealIP, r.Header.Get("X-Real-IP")), UserAgent: client.selectField(options.UserAgent, r.Header.Get("User-Agent")), AcceptLanguage: client.selectField(options.AcceptLanguage, r.Header.Get("Accept-Language")), Title: options.Title, diff --git a/go.mod b/go.mod index 93b9907..6dfdbd5 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,5 @@ go 1.16 require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/emvi/null v1.3.1 - github.com/stretchr/testify v1.7.1 - gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect + github.com/stretchr/testify v1.8.0 ) diff --git a/go.sum b/go.sum index 585a2fe..6d4af25 100644 --- a/go.sum +++ b/go.sum @@ -7,13 +7,18 @@ github.com/emvi/null v1.3.1/go.mod h1:tEZhBSLFCucrJdwRentxoOLVRpTCy/3aIfiNKE2uuY github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/types.go b/types.go index b640a29..41f2e79 100644 --- a/types.go +++ b/types.go @@ -28,10 +28,6 @@ type Hit struct { Hostname string URL string `json:"url"` IP string `json:"ip"` - CFConnectingIP string `json:"cf_connecting_ip"` - XForwardedFor string `json:"x_forwarded_for"` - Forwarded string `json:"forwarded"` - XRealIP string `json:"x_real_ip"` UserAgent string `json:"user_agent"` AcceptLanguage string `json:"accept_language"` Title string `json:"title"`