mirror of https://github.com/mpolden/echoip
Added extra IP Stack fields
- IsDaylightSavings - IsProxy - IsTOR - IsCrawler - CrawlerName - CrawlerType - ThreatLevel - ThreatTypes
This commit is contained in:
parent
09a47bea6a
commit
81aa484762
|
@ -136,6 +136,11 @@
|
|||
<th scope="row">Timezone</th>
|
||||
<td>{{ .Timezone }}</td>
|
||||
</tr>
|
||||
{{ end }} {{ if .IsDayLightSavings }}
|
||||
<tr>
|
||||
<th scope="row">Is Daylight Savings?</th>
|
||||
<td>{{ .IsDayLightSavings }}</td>
|
||||
</tr>
|
||||
{{ end }} {{ if .ASN }}
|
||||
<tr>
|
||||
<th scope="row">ASN</th>
|
||||
|
@ -166,7 +171,52 @@
|
|||
<th scope="row">User agent: Raw</th>
|
||||
<td>{{ .UserAgent.RawValue }}</td>
|
||||
</tr>
|
||||
{{ end }} {{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ if .IsProxy }}
|
||||
<tr>
|
||||
<th scope="row">Is Proxy?</th>
|
||||
<td>{{ .IsProxy }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
|
||||
{{ if .IsCrawler }}
|
||||
<tr>
|
||||
<th scope="row">Is Crawler?</th>
|
||||
<td>{{ .IsCrawler }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Crawler Name</th>
|
||||
<td>{{ .CrawlerName }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Crawler Type</th>
|
||||
<td>{{ .CrawlerType }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
|
||||
{{ if .IsTor }}
|
||||
<tr>
|
||||
<th scope="row">Is Tor?</th>
|
||||
<td>{{ .IsTor }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
|
||||
{{ if .ThreatLevel }}
|
||||
<tr>
|
||||
<th scope="row">Threat Level</th>
|
||||
<td>{{ .ThreatLevel }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
|
||||
{{ if .ThreatTypes }}
|
||||
<tr>
|
||||
<th scope="row">Threat Types</th>
|
||||
<td>{{ .ThreatTypes }}</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
</table>
|
||||
{{ if .Country }} {{ if .UsingGeoIP }}
|
||||
<p>
|
||||
|
|
|
@ -41,6 +41,17 @@ func (ips *IPStack) Parse(ip net.IP, hostname string) (parser.Response, error) {
|
|||
|
||||
if res.Timezone != nil {
|
||||
parserResponse.Timezone = res.Timezone.ID
|
||||
parserResponse.IsDayLightSavings = res.Timezone.IsDaylightSaving
|
||||
}
|
||||
|
||||
if res.Security != nil {
|
||||
parserResponse.IsProxy = res.Security.IsProxy
|
||||
parserResponse.IsCrawler = res.Security.IsCrawler
|
||||
parserResponse.CrawlerName = res.Security.CrawlerName
|
||||
parserResponse.CrawlerType = res.Security.CrawlerType
|
||||
parserResponse.IsTor = res.Security.IsTOR
|
||||
parserResponse.ThreatLevel = res.Security.ThreatLevel
|
||||
parserResponse.ThreatTypes = &res.Security.ThreatTypes
|
||||
}
|
||||
|
||||
if res.Location != nil {
|
||||
|
|
|
@ -13,23 +13,32 @@ type Parser interface {
|
|||
}
|
||||
|
||||
type Response struct {
|
||||
UsingGeoIP bool `json:"UsingGeoIP"`
|
||||
UsingIPStack bool `json:"UsingIPStack"`
|
||||
IP net.IP `json:"ip"`
|
||||
IPDecimal *big.Int `json:"ip_decimal"`
|
||||
Country string `json:"country,omitempty"`
|
||||
CountryISO string `json:"country_iso,omitempty"`
|
||||
CountryEU *bool `json:"country_eu,omitempty"`
|
||||
RegionName string `json:"region_name,omitempty"`
|
||||
RegionCode string `json:"region_code,omitempty"`
|
||||
MetroCode uint `json:"metro_code,omitempty"`
|
||||
PostalCode string `json:"zip_code,omitempty"`
|
||||
City string `json:"city,omitempty"`
|
||||
Latitude float64 `json:"latitude,omitempty"`
|
||||
Longitude float64 `json:"longitude,omitempty"`
|
||||
Timezone string `json:"time_zone,omitempty"`
|
||||
ASN string `json:"asn,omitempty"`
|
||||
ASNOrg string `json:"asn_org,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
UserAgent *useragent.UserAgent `json:"user_agent,omitempty"`
|
||||
UsingGeoIP bool `json:"UsingGeoIP"`
|
||||
UsingIPStack bool `json:"UsingIPStack"`
|
||||
IP net.IP `json:"ip"`
|
||||
IPDecimal *big.Int `json:"ip_decimal"`
|
||||
Country string `json:"country,omitempty"`
|
||||
CountryISO string `json:"country_iso,omitempty"`
|
||||
CountryEU *bool `json:"country_eu,omitempty"`
|
||||
RegionName string `json:"region_name,omitempty"`
|
||||
RegionCode string `json:"region_code,omitempty"`
|
||||
MetroCode uint `json:"metro_code,omitempty"`
|
||||
PostalCode string `json:"zip_code,omitempty"`
|
||||
City string `json:"city,omitempty"`
|
||||
Latitude float64 `json:"latitude,omitempty"`
|
||||
Longitude float64 `json:"longitude,omitempty"`
|
||||
Timezone string `json:"time_zone,omitempty"`
|
||||
IsDayLightSavings bool `json:"is_daylight_savings,omitempty"`
|
||||
ASN string `json:"asn,omitempty"`
|
||||
ASNOrg string `json:"asn_org,omitempty"`
|
||||
Hostname string `json:"hostname,omitempty"`
|
||||
UserAgent *useragent.UserAgent `json:"user_agent,omitempty"`
|
||||
CurrencyCode string `json:"currency_code,omitempty"`
|
||||
IsProxy bool `json:"is_proxy,omitempty"`
|
||||
IsCrawler bool `json:"is_crawler,omitempty"`
|
||||
CrawlerName string `json:"crawler_name,omitempty"`
|
||||
CrawlerType string `json:"crawler_type,omitempty"`
|
||||
IsTor bool `json:"is_tor,omitempty"`
|
||||
ThreatLevel string `json:"threat_level,omitempty"`
|
||||
ThreatTypes *interface{} `json:"threat_types,omitempty"`
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue