소스 검색

new fields for Ping

Tobias von Dewitz 4 년 전
부모
커밋
6058896243
3개의 변경된 파일31개의 추가작업 그리고 5개의 파일을 삭제
  1. 1 3
      go.mod
  2. 14 0
      go.sum
  3. 16 2
      ping.go

+ 1 - 3
go.mod

@@ -7,9 +7,7 @@ require (
 	git.scraperwall.com/scw/grs v0.0.0-20170601133330-3236d4163146
 	github.com/golang/protobuf v1.3.2
 	github.com/google/btree v1.0.0
-	github.com/oschwald/geoip2-golang v1.3.0 // indirect
-	github.com/oschwald/maxminddb-golang v1.5.0 // indirect
 	github.com/scraperwall/asndb v1.2.0
-	golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe // indirect
+	github.com/scraperwall/geoip v1.1.0
 	gopkg.in/jmcvetta/napping.v3 v3.2.0 // indirect
 )

+ 14 - 0
go.sum

@@ -4,17 +4,31 @@ git.scraperwall.com/scw/grs v0.0.0-20170601133330-3236d4163146 h1:pmtzyKPIrtqUmc
 git.scraperwall.com/scw/grs v0.0.0-20170601133330-3236d4163146/go.mod h1:tBzymrSfvUbefC/s0jnUtcHjpcZbH7+7f755VdGGhwM=
 git.scraperwall.com/scw/ip v0.0.0-20181127150108-80dbbe18947e h1:TJIzDykAwl9XbHGRGIp2gSKmUgCzhAcQDeEjXGSCblE=
 git.scraperwall.com/scw/ip v0.0.0-20181127150108-80dbbe18947e/go.mod h1:VWpgAIAUfNlojwRfuTrv2xh4EHYHSO0jV5CKEJyktrg=
+github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
 github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
 github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
 github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=
 github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
 github.com/oschwald/geoip2-golang v1.3.0 h1:D+Hsdos1NARPbzZ2aInUHZL+dApIzo8E0ErJVsWcku8=
 github.com/oschwald/geoip2-golang v1.3.0/go.mod h1:0LTTzix/Ao1uMvOhAV4iLU0Lz7eCrP94qZWBTDKf0iE=
+github.com/oschwald/geoip2-golang v1.4.0 h1:5RlrjCgRyIGDz/mBmPfnAF4h8k0IAcRv9PvrpOfz+Ug=
+github.com/oschwald/geoip2-golang v1.4.0/go.mod h1:8QwxJvRImBH+Zl6Aa6MaIcs5YdlZSTKtzmPGzQqi9ng=
 github.com/oschwald/maxminddb-golang v1.5.0 h1:rmyoIV6z2/s9TCJedUuDiKht2RN12LWJ1L7iRGtWY64=
 github.com/oschwald/maxminddb-golang v1.5.0/go.mod h1:3jhIUymTJ5VREKyIhWm66LJiQt04F0UCDdodShpjWsY=
+github.com/oschwald/maxminddb-golang v1.6.0 h1:KAJSjdHQ8Kv45nFIbtoLGrGWqHFajOIm7skTyz/+Dls=
+github.com/oschwald/maxminddb-golang v1.6.0/go.mod h1:DUJFucBg2cvqx42YmDa/+xHvb0elJtOm3o4aFQ/nb/w=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 github.com/scraperwall/asndb v1.2.0 h1:THsXpgeGb5Pdw1WMPBjwTnKRpnf5BVNxa8YKZ7V9bHQ=
 github.com/scraperwall/asndb v1.2.0/go.mod h1:FLEIYBOlrrLIu1gGSUIAGYdwV+DgEW9DQXuDvjvDMmw=
+github.com/scraperwall/geoip v1.1.0 h1:jvHjpDvW1+PogOkMChLA7BzFjqUJpjI58mAPs9QzKVU=
+github.com/scraperwall/geoip v1.1.0/go.mod h1:/Yg2uchWAnElEme1Aqf5x840A9Qw+3y+xxcybOM1KTs=
+github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
 golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe h1:6fAMxZRR6sl1Uq8U61gxU+kPTs2tR8uOySCbBP7BN/M=
 golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191224085550-c709ea063b76 h1:Dho5nD6R3PcW2SH1or8vS0dszDaXRxIw55lBX7XiE5g=
+golang.org/x/sys v0.0.0-20191224085550-c709ea063b76/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/jmcvetta/napping.v3 v3.2.0 h1:NpSZLAL6VgiyhdqaOkxwVtHXOLrQJZ6fFOMQgp7G8PQ=
 gopkg.in/jmcvetta/napping.v3 v3.2.0/go.mod h1:0dPR4/IGM4+xGT+e48O2yJlg6qofrONCtEAWkurVlZQ=
+gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

+ 16 - 2
ping.go

@@ -1,7 +1,21 @@
 package data
 
+import (
+	"github.com/scraperwall/asndb"
+	"github.com/scraperwall/geoip"
+)
+
 // Ping is used as a primitive way to validate that a browser has JS
 type Ping struct {
-	Timestamp uint32
-	Checksum  string
+	Timestamp     int64        `bson:"timestamp" json:"timestamp" form:"timestamp"`
+	Checksum      string       `bson:"checksum" json:"checksum" form:"checksum"`
+	Remote        string       `bson:"remote" json:"remote" form:"remote"`
+	URL           string       `bson:"url" json:"url" form:"url"`
+	Source        string       `bson:"source" json:"source" form:"source"`
+	XForwardedFor string       `bson:"x_forwarded_for" json:"x-forwarded-for" form:"x_forwarded_for"`
+	XRealIP       string       `bson:"x_real_ip" json:"x-real-ip" form:"x_real_ip"`
+	XScwIP        string       `bson:"x_scw_ip" json:"x-scw-ip" form:"x_scw_ip"`
+	ASN           *asndb.ASN   `bson:"asn" json:"asn" form:"asn"`
+	GeoIP         *geoip.GeoIP `bson:"geoip" json:"geoip" form:"geoip"`
+	ClientID      string       `bson:"clientid" json:"clientid" form:"clientid"`
 }