asnmap

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 26 Imported by: 16

Documentation

Index

Constants

View Source
const Version = `v1.1.1`

Version is the current Version of asnmap

Variables

View Source
var (
	PDCPApiKey      = env.GetEnvOrDefault("PDCP_API_KEY", "")
	ErrUnAuthorized = errors.New("unauthorized: 401 (get free api key to configure from https://cloud.projectdiscovery.io/?ref=api_key)")
)

Functions

func GetCIDR

func GetCIDR(output []*Response) ([]*net.IPNet, error)

func ResolveDomain

func ResolveDomain(domain string, customresolvers ...string) ([]string, error)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}
var DefaultClient *Client

func NewClient

func NewClient() (*Client, error)

func (Client) GetData

func (c Client) GetData(input string, medatadas ...string) ([]*Response, error)

func (Client) GetDataWithCustomInput added in v1.0.3

func (c Client) GetDataWithCustomInput(inputToQuery, inputToUseInResponse string) ([]*Response, error)

func (*Client) SetProxy added in v1.0.0

func (c *Client) SetProxy(proxyList []string) (*url.URL, error)

SetProxy adds a proxy to the client

type InputType added in v1.0.0

type InputType uint8
const (
	ASN InputType = iota
	ASNID
	IP
	Org
	Domain
	Unknown
)

func IdentifyInput

func IdentifyInput(input string) InputType

type Response

type Response struct {
	FirstIp string `json:"first_ip,omitempty"`
	LastIp  string `json:"last_ip,omitempty"`
	Input   string `json:"-"` // added by client
	ASN     int    `json:"asn,omitempty"`
	Country string `json:"country,omitempty"`
	Org     string `json:"org,omitempty"`
}

To model http response from server

func GetData added in v1.0.0

func GetData(input string) ([]*Response, error)

func (Response) Equal added in v1.1.0

func (r Response) Equal(r2 Response) bool

type Result

type Result struct {
	Timestamp  string   `json:"timestamp,omitempty" csv:"timestamp"`
	Input      string   `json:"input" csv:"input"`
	ASN        string   `json:"as_number" csv:"as_number"`
	ASN_org    string   `json:"as_name" csv:"as_name"`
	AS_country string   `json:"as_country" csv:"as_country"`
	AS_range   []string `json:"as_range" csv:"as_range"`
}

func MapToResults added in v1.1.0

func MapToResults(output []*Response) ([]*Result, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL