Go SDK
github.com/Neivi-IT/iqx-lookup-go — Go 1.21+ client for the IQX Lookup API using net/http (zero dependencies).
Installation
go get github.com/Neivi-IT/iqx-lookup-go
Quick Start
package main
import (
"context"
"fmt"
"log"
iqxlookup "github.com/Neivi-IT/iqx-lookup-go"
)
func main() {
client := iqxlookup.New("ALk-your-api-key")
ctx := context.Background()
// Validate an email
email, err := client.ValidateEmail(ctx, "user@example.com")
if err != nil {
log.Fatal(err)
}
fmt.Println("Valid format:", email.ValidFormat)
fmt.Println("Disposable:", email.DisposableEmail)
// Validate a phone number
phone, err := client.ValidatePhone(ctx, "+34912345678", "ES")
if err != nil {
log.Fatal(err)
}
fmt.Println("Valid:", phone.Valid)
// Geolocate an IP
ip, err := client.GeolocateIP(ctx, "8.8.8.8")
if err != nil {
log.Fatal(err)
}
fmt.Println("Country:", ip.CountryName)
// Validate a VAT number
vat, err := client.ValidateVat(ctx, "ES", "B87387775")
if err != nil {
log.Fatal(err)
}
fmt.Println("Valid:", vat.Valid)
// Parse a user-agent string
ua, err := client.ParseUserAgent(ctx, "Mozilla/5.0...")
if err != nil {
log.Fatal(err)
}
fmt.Println("Browser:", ua.BrowserFamily)
}
Configuration
import "time"
// With options
client := iqxlookup.New("ALk-your-api-key",
iqxlookup.WithBaseURL("https://api.iqxlookup.neivi.es"), // optional
iqxlookup.WithTimeout(15 * time.Second), // optional, default 10s
)
API Reference
All methods take context.Context as the first parameter and return (result, error):
| Method | Returns | Description |
|---|---|---|
ValidateEmail(ctx, address) | *EmailValidationResult | Email format, MX, disposable, free provider checks |
ValidatePhone(ctx, number, countryCode) | *PhoneValidationResult | Phone validation (empty countryCode = omit) |
GeolocateIP(ctx, ip) | *IPGeolocation | IP geolocation + ASN (empty ip = caller's IP) |
ValidateVat(ctx, countryCode, number) | *VatValidationResult | EU VIES VAT validation |
ParseUserAgent(ctx, ua) | *UserAgentResult | UA parsing — browser, OS, device brand & model |
ValidateIban(ctx, iban) | *IbanValidationResult | IBAN structure, checksum, bank info |
ValidateBic(ctx, bic) | *BicValidationResult | BIC/SWIFT format, institution info |
LookupDns(ctx, domain, types) | *DnsLookupResult | DNS records, SPF/DKIM/DMARC security |
CheckSsl(ctx, domain) | *SslCertificateResult | SSL certificate, chain, grade |
AnalyzePassword(ctx, password) | *PasswordStrengthResult | Strength score, crack time, breach check |
ValidateCreditCard(ctx, number) | *CreditCardValidationResult | Luhn check, card network, BIN lookup |
LastRateLimitInfo() | *RateLimitInfo | Rate limit from last response |
Error Handling
Use errors.As for typed error checking:
import "errors"
email, err := client.ValidateEmail(ctx, "user@example.com")
if err != nil {
var rateLimitErr *iqxlookup.RateLimitError
var unauthorizedErr *iqxlookup.UnauthorizedError
if errors.As(err, &rateLimitErr) {
fmt.Printf("Retry after: %ds\n", rateLimitErr.RetryAfter)
} else if errors.As(err, &unauthorizedErr) {
fmt.Println("Check your API key")
} else {
fmt.Println("Error:", err)
}
}
Requirements
- Go 1.21+
- Zero external dependencies (uses
net/httpfrom stdlib)