Go integration
Block disposable emails in Go
You're running a Go service and fake signups keep getting through. Add one request to your signup handler and Fidro checks the email and IP before the account exists.
How it works
Send the user's email and IP to Fidro with the standard library's net/http. Fidro checks the address, the network and what it has already seen from them, then answers allow, challenge or block in a single JSON response. Nothing to install.
One fake signup can look perfectly normal. Five from the same IP in an hour don't. Send event and user_id with each call and Fidro remembers, so it catches the pattern as well as the person. You get a score from 0 to 100 and one answer: allow, challenge or block.
1. Install what you need
# Nothing to install: the standard library covers it
You'll also need an API key. Sign up free and you'll have one in a minute, no card needed.
2. Check every signup
Send the email and IP to POST /api/validate. Fidro checks for disposable domains, missing mail servers, VPNs, proxies and Tor, and answers allow, challenge or block. Let the allows straight in, ask the challenges to confirm their email, and turn the blocks away.
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"os"
"time"
)
type ValidateRequest struct {
Email string `json:"email"`
IP string `json:"ip"`
Event string `json:"event,omitempty"`
}
type ValidateResponse struct {
RiskScore float64 `json:"risk_score"`
Recommendation string `json:"recommendation"` // allow, challenge or block
Message string `json:"message"`
}
var client = &http.Client{Timeout: 5 * time.Second}
func checkSignup(email, ip string) (*ValidateResponse, error) {
payload, _ := json.Marshal(ValidateRequest{Email: email, IP: ip, Event: "signup"})
req, err := http.NewRequest("POST", "https://fidro.io/api/validate", bytes.NewBuffer(payload))
if err != nil {
return nil, fmt.Errorf("creating request: %w", err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("FIDRO_API_KEY"))
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
return nil, fmt.Errorf("sending request: %w", err)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("API error: %s", resp.Status)
}
var result ValidateResponse
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
return nil, fmt.Errorf("decoding response: %w", err)
}
return &result, nil
}
func main() {
result, err := checkSignup("test@example.com", "8.8.8.8")
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
fmt.Printf("Risk score: %.0f\n", result.RiskScore)
fmt.Printf("Recommendation: %s\n", result.Recommendation)
if result.Recommendation == "block" {
// Refuse the signup
}
}
3. Look up an IP
Just want to know where a request came from? GET /api/ip/{ip} returns the country, city, ISP and network, without scoring. The VPN, proxy and Tor flags come from /api/validate, under data.checks.
package main
import (
"encoding/json"
"fmt"
"net/http"
"os"
"time"
)
type IPLookupResponse struct {
IP string `json:"ip"`
Location struct {
CountryName string `json:"country_name"`
City string `json:"city"`
ISP string `json:"isp"`
} `json:"location"`
}
var client = &http.Client{Timeout: 5 * time.Second}
func lookupIP(ip string) (*IPLookupResponse, error) {
req, err := http.NewRequest("GET", "https://fidro.io/api/ip/"+ip, nil)
if err != nil {
return nil, fmt.Errorf("creating request: %w", err)
}
req.Header.Set("Authorization", "Bearer "+os.Getenv("FIDRO_API_KEY"))
resp, err := client.Do(req)
if err != nil {
return nil, fmt.Errorf("sending request: %w", err)
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("API error: %s", resp.Status)
}
var result IPLookupResponse
if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
return nil, fmt.Errorf("decoding response: %w", err)
}
return &result, nil
}
func main() {
result, err := lookupIP("8.8.8.8")
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
fmt.Printf("Country: %s\n", result.Location.CountryName)
fmt.Printf("ISP: %s\n", result.Location.ISP)
}
Want to see real results first? Try any address in the free IP checker.
Next steps
The API reference has every field. The free checker shows you real results. And if you're weighing up alternatives, the comparisons are honest about where others fit.
Frequently Asked Questions
How do I add fraud detection to Go?
Does Fidro have a Go SDK?
Is Fidro free to use with Go?
What should I do when Fidro says challenge?
Start catching bad signups in the next 5 minutes
Create your account, grab your API key, and send your first request. Free plan with 200 validations/month. No credit card. Cancel anytime.