Skip to content

Commit

Permalink
Removed IP headers, updated dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kugelschieber committed Jul 1, 2022
1 parent eff990b commit b38d55d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 22 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
20 changes: 4 additions & 16 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}

Expand Down Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
5 changes: 5 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
4 changes: 0 additions & 4 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit b38d55d

Please sign in to comment.