Documentation
¶
Overview ¶
Package netident identifies network providers, bots, and cloud hosts by matching IP, PTR, WHOIS, and ASN fields against a weighted JSON rule database.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Detector ¶
type Detector struct {
// contains filtered or unexported fields
}
func New ¶
Example (Identify) ¶
package main
import (
"fmt"
"github.com/aredoff/netident"
)
func main() {
d, err := netident.New()
if err != nil {
fmt.Println(err)
return
}
result := d.Identify(netident.Input{
PTR: "crawl-66-249-79-1.googlebot.com",
})
fmt.Println(result.ProviderID, result.Score, result.OK)
}
Output: googlebot 1000 true
func (*Detector) IdentifyAll ¶
Example ¶
package main
import (
"fmt"
"net"
"github.com/aredoff/netident"
)
func main() {
d, err := netident.NewFromFile("testdata/providers_minimal.json")
if err != nil {
fmt.Println(err)
return
}
ip := net.ParseIP("66.249.79.1")
all := d.IdentifyAll(netident.Input{IP: ip})
if len(all) == 0 {
fmt.Println("none")
return
}
fmt.Println(all[0].ProviderID, all[0].Score)
}
Output: googlebot 900
type FileCache ¶
type FileCache struct {
// contains filtered or unexported fields
}
func NewFileCache ¶
type NetworkCache ¶
type Option ¶
type Option func(*options)
func WithCache ¶
func WithCache(c NetworkCache) Option
func WithCacheDir ¶
func WithHTTPClient ¶
func WithLogger ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.