Documentation
¶
Index ¶
- func ExtractASN(whoisOutput string) string
- func ExtractCIDRsByCountry(response *utilsfern.BgpViewResponse, countryCode string) []string
- func GetASNCIDRs(ctx context.Context, asn string) ([]string, error)
- func GetASNCIDRsDetailed(ctx context.Context, asn string) (*utilsfern.BgpViewResponse, error)
- func GetASNCIDRsWithTimeout(ctx context.Context, asn string, timeout time.Duration) ([]string, error)
- func GetASNDescription(ctx context.Context, asn string, timeout ...time.Duration) (string, error)
- func GetASNInfo(ctx context.Context, asn string) (*utilsfern.BgpViewResponse, error)
- func GetASNInfoWithTimeout(ctx context.Context, asn string, timeout time.Duration) (*utilsfern.BgpViewResponse, error)
- func GetEntriesFromFiles(paths []string) ([]string, error)
- func GetResolver(dnsServerAddress string, log svc1log.Logger) *net.Resolver
- func IPASNLookup(ctx context.Context, ip string) (string, error)
- func IPASNLookupDetailed(ctx context.Context, ip string) (*utilsfern.CymruAsnResult, error)
- func IPASNLookupWithFallback(ctx context.Context, ip string) (string, error)
- func ValidateDNSServerAddress(address string) error
- func WhoisASN(query string) (string, error)
- func WhoisASNWithContext(ctx context.Context, query string) (string, error)
- type BGPViewClient
- func (c *BGPViewClient) GetASNInfo(ctx context.Context, asn string) (*utilsfern.BgpViewResponse, error)
- func (c *BGPViewClient) GetASNInfoWithTimeout(ctx context.Context, asn string, timeout time.Duration) (*utilsfern.BgpViewResponse, error)
- func (c *BGPViewClient) GetASNPrefixes(ctx context.Context, asn string) (*utilsfern.BgpViewResponse, error)
- func (c *BGPViewClient) GetASNPrefixesWithTimeout(ctx context.Context, asn string, timeout time.Duration) (*utilsfern.BgpViewResponse, error)
- func (c *BGPViewClient) SetTimeout(timeout time.Duration) *BGPViewClient
- func (c *BGPViewClient) SetUserAgent(userAgent string) *BGPViewClient
- type WhoisClient
- func (c *WhoisClient) SetServers(servers []string) *WhoisClient
- func (c *WhoisClient) SetTimeout(timeout time.Duration) *WhoisClient
- func (c *WhoisClient) Whois(query string) (string, error)
- func (c *WhoisClient) WhoisWithContext(ctx context.Context, query string) (string, error)
- func (c *WhoisClient) WhoisWithContextAndServer(ctx context.Context, query string, server string) (string, error)
- func (c *WhoisClient) WhoisWithContextAndServerVerbose(ctx context.Context, query string, server string) (string, error)
- func (c *WhoisClient) WhoisWithServer(query string, server string) (string, error)
- func (c *WhoisClient) WhoisWithServerVerbose(query string, server string) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractASN ¶ added in v0.0.51
ExtractASN extracts ASN information from whois output
func ExtractCIDRsByCountry ¶ added in v0.0.51
func ExtractCIDRsByCountry(response *utilsfern.BgpViewResponse, countryCode string) []string
ExtractCIDRsByCountry filters CIDRs by country code from BGPView response
func GetASNCIDRs ¶ added in v0.0.51
GetASNCIDRs retrieves all CIDR prefixes for a given ASN using BGPView API This is the main function called by the ASN discovery module
func GetASNCIDRsDetailed ¶ added in v0.0.51
GetASNCIDRsDetailed retrieves detailed CIDR information for a given ASN Returns the full BGPView response with additional metadata
func GetASNCIDRsWithTimeout ¶ added in v0.0.51
func GetASNCIDRsWithTimeout(ctx context.Context, asn string, timeout time.Duration) ([]string, error)
GetASNCIDRsWithTimeout retrieves all CIDR prefixes for a given ASN using BGPView API with timeout
func GetASNDescription ¶ added in v0.0.51
GetASNDescription looks up the description for a given ASN using Cymru's asn.cymru.com zone Example query: dig +short AS23028.asn.cymru.com TXT
func GetASNInfo ¶ added in v0.0.51
GetASNInfo retrieves comprehensive ASN information using BGPView API
func GetASNInfoWithTimeout ¶ added in v0.0.51
func GetASNInfoWithTimeout(ctx context.Context, asn string, timeout time.Duration) (*utilsfern.BgpViewResponse, error)
GetASNInfoWithTimeout retrieves comprehensive ASN information using BGPView API with timeout
func GetEntriesFromFiles ¶
func GetResolver ¶ added in v0.0.32
GetResolver returns a new resolver with the given DNS server address. If the DNS server address is empty, the system default resolver is used. If the DNS server address is provided, the resolver is configured to use the given DNS server address.
func IPASNLookup ¶ added in v0.0.51
IPASNLookup performs an ASN lookup using the Cymru DNS service Returns ASN information for the given IP address using raw DNS queries
func IPASNLookupDetailed ¶ added in v0.0.51
IPASNLookupDetailed performs an ASN lookup using the Cymru DNS service Returns detailed ASN information for the given IP address using raw DNS queries
func IPASNLookupWithFallback ¶ added in v0.0.51
IPASNLookupWithFallback tries Cymru DNS first, then falls back to whois if needed
func ValidateDNSServerAddress ¶ added in v0.0.32
ValidateDNSServerAddress checks if the DNS server address is in the correct format (IP:PORT or HOSTNAME:PORT)
Types ¶
type BGPViewClient ¶ added in v0.0.51
type BGPViewClient struct {
// contains filtered or unexported fields
}
BGPViewClient represents a client for the BGPView.io API
func NewBGPViewClient ¶ added in v0.0.51
func NewBGPViewClient() *BGPViewClient
NewBGPViewClient creates a new BGPView API client
func (*BGPViewClient) GetASNInfo ¶ added in v0.0.51
func (c *BGPViewClient) GetASNInfo(ctx context.Context, asn string) (*utilsfern.BgpViewResponse, error)
GetASNInfo retrieves basic ASN information using BGPView API This provides an alternative to Cymru DNS for ASN description lookup
func (*BGPViewClient) GetASNInfoWithTimeout ¶ added in v0.0.51
func (c *BGPViewClient) GetASNInfoWithTimeout(ctx context.Context, asn string, timeout time.Duration) (*utilsfern.BgpViewResponse, error)
GetASNInfoWithTimeout retrieves basic ASN information using BGPView API with timeout
func (*BGPViewClient) GetASNPrefixes ¶ added in v0.0.51
func (c *BGPViewClient) GetASNPrefixes(ctx context.Context, asn string) (*utilsfern.BgpViewResponse, error)
GetASNPrefixes retrieves all BGP prefixes for a given ASN
func (*BGPViewClient) GetASNPrefixesWithTimeout ¶ added in v0.0.51
func (c *BGPViewClient) GetASNPrefixesWithTimeout(ctx context.Context, asn string, timeout time.Duration) (*utilsfern.BgpViewResponse, error)
GetASNPrefixesWithTimeout retrieves all BGP prefixes for a given ASN with timeout
func (*BGPViewClient) SetTimeout ¶ added in v0.0.51
func (c *BGPViewClient) SetTimeout(timeout time.Duration) *BGPViewClient
SetTimeout sets the HTTP client timeout
func (*BGPViewClient) SetUserAgent ¶ added in v0.0.51
func (c *BGPViewClient) SetUserAgent(userAgent string) *BGPViewClient
SetUserAgent sets a custom User-Agent header
type WhoisClient ¶ added in v0.0.51
type WhoisClient struct {
// contains filtered or unexported fields
}
WhoisClient represents a whois client
func NewWhoisClient ¶ added in v0.0.51
func NewWhoisClient() *WhoisClient
NewWhoisClient creates a new whois client
func (*WhoisClient) SetServers ¶ added in v0.0.51
func (c *WhoisClient) SetServers(servers []string) *WhoisClient
SetServers sets the whois servers to use
func (*WhoisClient) SetTimeout ¶ added in v0.0.51
func (c *WhoisClient) SetTimeout(timeout time.Duration) *WhoisClient
SetTimeout sets the timeout for whois queries
func (*WhoisClient) Whois ¶ added in v0.0.51
func (c *WhoisClient) Whois(query string) (string, error)
Whois performs a whois lookup on the given domain/IP
func (*WhoisClient) WhoisWithContext ¶ added in v0.0.51
WhoisWithContext performs a whois lookup with a custom context
func (*WhoisClient) WhoisWithContextAndServer ¶ added in v0.0.51
func (c *WhoisClient) WhoisWithContextAndServer(ctx context.Context, query string, server string) (string, error)
WhoisWithContextAndServer performs a whois lookup with a custom context and specified server
func (*WhoisClient) WhoisWithContextAndServerVerbose ¶ added in v0.0.51
func (c *WhoisClient) WhoisWithContextAndServerVerbose(ctx context.Context, query string, server string) (string, error)
WhoisWithContextAndServerVerbose performs a whois lookup with a custom context, specified server, and verbose output
func (*WhoisClient) WhoisWithServer ¶ added in v0.0.51
func (c *WhoisClient) WhoisWithServer(query string, server string) (string, error)
WhoisWithServer performs a whois lookup on the given domain/IP with a specified server
func (*WhoisClient) WhoisWithServerVerbose ¶ added in v0.0.51
func (c *WhoisClient) WhoisWithServerVerbose(query string, server string) (string, error)
WhoisWithServerVerbose performs a whois lookup on the given domain/IP with a specified server and verbose output