handlers

package
v0.0.0-...-4632128 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 38 Imported by: 0

Documentation

Overview

Package handlers contains all API endpoint handlers. Each handler follows the same pattern:

  1. Parse the request
  2. Do the work (run a command, call an API, etc.)
  3. Deduct sats
  4. Return JSON response

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AIChatMessage

type AIChatMessage struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

type AIChatRequest

type AIChatRequest struct {
	Prompt       string          `json:"prompt,omitempty"`
	SystemPrompt string          `json:"system_prompt,omitempty"`
	Messages     []AIChatMessage `json:"messages,omitempty"`
}

type AIChatResponse

type AIChatResponse struct {
	Answer string       `json:"answer"`
	Model  string       `json:"model"`
	Usage  *AIChatUsage `json:"usage,omitempty"`
}

type AIChatUsage

type AIChatUsage struct {
	PromptTokens     int `json:"prompt_tokens"`
	CompletionTokens int `json:"completion_tokens"`
	TotalTokens      int `json:"total_tokens"`
}

type AITranslateRequest

type AITranslateRequest struct {
	Text           string `json:"text"`
	TargetLanguage string `json:"target_language,omitempty"`
	SourceLanguage string `json:"source_language,omitempty"`
	Style          string `json:"style,omitempty"`
}

type AITranslateResponse

type AITranslateResponse struct {
	Text             string       `json:"text"`
	TranslatedText   string       `json:"translated_text"`
	TargetLanguage   string       `json:"target_language"`
	SourceLanguage   string       `json:"source_language"`
	DetectedLanguage string       `json:"detected_language,omitempty"`
	Style            string       `json:"style"`
	Model            string       `json:"model"`
	Usage            *AIChatUsage `json:"usage,omitempty"`
}

type APIResponse

type APIResponse struct {
	Success          bool        `json:"success"`
	Data             interface{} `json:"data,omitempty"`
	Error            string      `json:"error,omitempty"`
	CostSats         int         `json:"cost_sats"`
	BalanceRemaining int64       `json:"balance_remaining"`
	ResponseMs       int         `json:"response_ms"`
	Endpoint         string      `json:"endpoint"`
}

APIResponse is the standard response wrapper for all endpoints

type AXFRCheckRequest

type AXFRCheckRequest struct {
	Domain string `json:"domain"`
}

type AXFRCheckResponse

type AXFRCheckResponse struct {
	Domain               string                 `json:"domain"`
	Allowed              bool                   `json:"allowed"`
	Explanation          string                 `json:"explanation"`
	NameserversChecked   []string               `json:"nameservers_checked"`
	SuccessfulNameserver string                 `json:"successful_nameserver,omitempty"`
	TransferRecordCount  int                    `json:"transfer_record_count"`
	Truncated            bool                   `json:"truncated,omitempty"`
	Records              map[string][]DNSRecord `json:"records,omitempty"`
}

type AdminOverviewResponse

type AdminOverviewResponse struct {
	GeneratedAt  string      `json:"generated_at"`
	PaymentMode  string      `json:"payment_mode"`
	Usage        interface{} `json:"usage"`
	Traffic      interface{} `json:"traffic,omitempty"`
	MasterWallet interface{} `json:"master_wallet,omitempty"`
}

type AdminTrafficPath

type AdminTrafficPath struct {
	Path     string `json:"path"`
	Requests int64  `json:"requests"`
}

type AdminTrafficReport

type AdminTrafficReport struct {
	WindowHours      int                  `json:"window_hours"`
	TotalRequests    int64                `json:"total_requests"`
	ExternalRequests int64                `json:"external_requests"`
	UniqueIPs        int                  `json:"unique_ips"`
	ExternalIPs      int                  `json:"external_ips"`
	PageHits         int64                `json:"page_hits"`
	CrawlerRequests  int64                `json:"crawler_requests"`
	TopPaths         []AdminTrafficPath   `json:"top_paths"`
	TopSources       []AdminTrafficSource `json:"top_sources"`
}

type AdminTrafficSource

type AdminTrafficSource struct {
	IP       string `json:"ip"`
	Kind     string `json:"kind"`
	Requests int64  `json:"requests"`
	LastPath string `json:"last_path"`
	LastSeen string `json:"last_seen"`
}

type BTCFearGreed

type BTCFearGreed struct {
	Value     float64   `json:"value"`
	Label     string    `json:"label"`
	Source    string    `json:"source"`
	UpdatedAt time.Time `json:"updated_at"`
}

type BTCMarketStats

type BTCMarketStats struct {
	Rank         int     `json:"rank"`
	Change1hPct  float64 `json:"change_1h_pct"`
	Change24hPct float64 `json:"change_24h_pct"`
	Change7dPct  float64 `json:"change_7d_pct"`
	Volume24hUSD float64 `json:"volume_24h_usd"`
	MarketCapUSD float64 `json:"market_cap_usd"`
	Source       string  `json:"source"`
}

type BTCPriceResponse

type BTCPriceResponse struct {
	BTCUSD      string          `json:"btc_usd"`
	BTCEUR      string          `json:"btc_eur"`
	BTCGBP      string          `json:"btc_gbp"`
	BTCCAD      string          `json:"btc_cad"`
	BTCJPY      string          `json:"btc_jpy"`
	BTCAUD      string          `json:"btc_aud"`
	BTCCHF      string          `json:"btc_chf"`
	BTCCNY      string          `json:"btc_cny"`
	BTCHKD      string          `json:"btc_hkd"`
	BTCSGD      string          `json:"btc_sgd"`
	MarketStats *BTCMarketStats `json:"market_stats,omitempty"`
	FearGreed   *BTCFearGreed   `json:"fear_greed,omitempty"`
	UpdatedAt   time.Time       `json:"updated_at"`
}

BTCPriceResponse is what we return

type BarkSessionResponse

type BarkSessionResponse struct {
	Token       string      `json:"token"`
	Funding     FundingInfo `json:"funding"`
	AmountSats  int64       `json:"amount_sats"`
	BalanceSats int64       `json:"balance_sats"`
	Status      string      `json:"status"`
	ExpiresIn   int         `json:"expires_in"`
}

BarkSessionResponse is returned when creating a session in bark mode

type BitcoinAddressBalance

type BitcoinAddressBalance struct {
	ConfirmedSats   int64 `json:"confirmed_sats"`
	UnconfirmedSats int64 `json:"unconfirmed_sats"`
	TxCount         int   `json:"tx_count"`
}

BitcoinAddressBalance holds on-chain balance data

type BitcoinAddressRequest

type BitcoinAddressRequest struct {
	Address string `json:"address"`
}

BitcoinAddressRequest is what the consumer sends

type BitcoinAddressResponse

type BitcoinAddressResponse struct {
	Address     string                 `json:"address"`
	Valid       bool                   `json:"valid"`
	Type        string                 `json:"type,omitempty"`
	Network     string                 `json:"network,omitempty"`
	Format      string                 `json:"format,omitempty"`
	Description string                 `json:"description,omitempty"`
	Balance     *BitcoinAddressBalance `json:"balance"`
	Cached      bool                   `json:"cached"`
}

BitcoinAddressResponse is what we return

type BitcoinNewsItem

type BitcoinNewsItem struct {
	Title       string `json:"title"`
	Link        string `json:"link"`
	Source      string `json:"source"`
	PublishedAt string `json:"published_at"`
	Summary     string `json:"summary,omitempty"`
	Sentiment   string `json:"sentiment,omitempty"`
}

type BitcoinNewsRequest

type BitcoinNewsRequest struct {
	Limit int `json:"limit,omitempty"`
}

type BitcoinNewsResponse

type BitcoinNewsResponse struct {
	Items []BitcoinNewsItem `json:"items"`
}

type CVELookupRequest

type CVELookupRequest struct {
	CVE string `json:"cve"`
}

type CVELookupResponse

type CVELookupResponse struct {
	CVEID               string   `json:"cve_id"`
	Found               bool     `json:"found"`
	Source              string   `json:"source"`
	NVDURL              string   `json:"nvd_url,omitempty"`
	PrimaryReferenceURL string   `json:"primary_reference_url,omitempty"`
	Published           string   `json:"published,omitempty"`
	LastModified        string   `json:"last_modified,omitempty"`
	VulnerabilityStatus string   `json:"vulnerability_status,omitempty"`
	Description         string   `json:"description,omitempty"`
	Severity            string   `json:"severity,omitempty"`
	CVSSScore           float64  `json:"cvss_score,omitempty"`
	CVSSVector          string   `json:"cvss_vector,omitempty"`
	CWEs                []string `json:"cwes,omitempty"`
	References          []string `json:"references,omitempty"`
	HasKEV              bool     `json:"has_kev"`
	KEVAdded            string   `json:"kev_added,omitempty"`
	RequiredAction      string   `json:"required_action,omitempty"`
}

type CVESearchItem

type CVESearchItem struct {
	CVEID               string  `json:"cve_id"`
	NVDURL              string  `json:"nvd_url"`
	PrimaryReferenceURL string  `json:"primary_reference_url,omitempty"`
	Published           string  `json:"published,omitempty"`
	LastModified        string  `json:"last_modified,omitempty"`
	Description         string  `json:"description,omitempty"`
	Severity            string  `json:"severity,omitempty"`
	CVSSScore           float64 `json:"cvss_score,omitempty"`
	HasKEV              bool    `json:"has_kev"`
}

type CVESearchRequest

type CVESearchRequest struct {
	Query string `json:"query"`
	Limit int    `json:"limit,omitempty"`
}

type CVESearchResponse

type CVESearchResponse struct {
	Query   string          `json:"query"`
	Results []CVESearchItem `json:"results"`
}

type DKIMResult

type DKIMResult struct {
	Present          bool              `json:"present"`
	SelectorUsed     string            `json:"selector_used,omitempty"`
	SelectorsChecked []string          `json:"selectors_checked"`
	FoundSelectors   []string          `json:"found_selectors,omitempty"`
	Records          map[string]string `json:"records,omitempty"`
}

type DNSRecord

type DNSRecord struct {
	Name  string `json:"name"`
	TTL   string `json:"ttl"`
	Type  string `json:"type"`
	Value string `json:"value"`
}

DNSRecord is a single DNS record

type DNSRequest

type DNSRequest struct {
	Domain string `json:"domain"`
}

DNSRequest is what the consumer sends

type DNSResponse

type DNSResponse struct {
	Domain  string                 `json:"domain"`
	Records map[string][]DNSRecord `json:"records"`
	Raw     string                 `json:"raw,omitempty"`
}

DNSResponse is what we return

type DomainCheckRequest

type DomainCheckRequest struct {
	Domain string `json:"domain"`
}

DomainCheckRequest is what the consumer sends

type DomainCheckResponse

type DomainCheckResponse struct {
	Domain      string   `json:"domain"`
	Available   bool     `json:"available"`
	Registrar   string   `json:"registrar,omitempty"`
	CreatedDate string   `json:"created_date,omitempty"`
	ExpiryDate  string   `json:"expiry_date,omitempty"`
	NameServers []string `json:"name_servers,omitempty"`
}

DomainCheckResponse is the parsed domain availability data

type DomainHostIntel

type DomainHostIntel struct {
	Hostname    string       `json:"hostname"`
	IPs         []string     `json:"ips,omitempty"`
	ResolvedIPs []IPResponse `json:"resolved_ips,omitempty"`
}

type DomainIntelCacheMetadata

type DomainIntelCacheMetadata struct {
	Cached     bool   `json:"cached"`
	TTLSeconds int    `json:"ttl_seconds"`
	ExpiresAt  string `json:"expires_at"`
}

type DomainIntelRequest

type DomainIntelRequest struct {
	Domain    string `json:"domain"`
	AISummary bool   `json:"ai_summary,omitempty"`
}

type DomainIntelResponse

type DomainIntelResponse struct {
	Domain          string                    `json:"domain"`
	AISummary       *AIChatResponse           `json:"ai_summary,omitempty"`
	Registration    *DomainRegistrationInfo   `json:"registration,omitempty"`
	Providers       *DomainProviderSummary    `json:"providers,omitempty"`
	Network         *DomainNetworkSummary     `json:"network,omitempty"`
	NameServerIntel []DomainHostIntel         `json:"nameserver_intel,omitempty"`
	MailHostIntel   []DomainHostIntel         `json:"mail_host_intel,omitempty"`
	Infrastructure  []string                  `json:"infrastructure_observations,omitempty"`
	SecurityTXT     *SecurityTXTResponse      `json:"security_txt,omitempty"`
	RobotsTXT       *RobotsTXTResponse        `json:"robots_txt,omitempty"`
	TechFingerprint *TechFingerprintResponse  `json:"tech_fingerprint,omitempty"`
	HTTPBehavior    *HTTPBehaviorResponse     `json:"http_behavior,omitempty"`
	Subdomains      []string                  `json:"subdomains,omitempty"`
	CTSubdomains    []string                  `json:"ct_subdomains,omitempty"`
	Findings        []string                  `json:"findings,omitempty"`
	Recommendations []string                  `json:"recommendations,omitempty"`
	Cache           *DomainIntelCacheMetadata `json:"cache,omitempty"`
	DNS             *DNSResponse              `json:"dns,omitempty"`
	Whois           *WhoisResponse            `json:"whois,omitempty"`
	SSL             *SSLResponse              `json:"ssl,omitempty"`
	Headers         *HeadersResponse          `json:"headers,omitempty"`
	EmailAuth       *EmailAuthCheckResponse   `json:"email_auth,omitempty"`
	ResolvedIPs     []IPResponse              `json:"resolved_ips,omitempty"`
	Errors          map[string]string         `json:"errors,omitempty"`
}

type DomainNetworkSummary

type DomainNetworkSummary struct {
	IPCount       int      `json:"ip_count"`
	ASNs          []string `json:"asns,omitempty"`
	Organizations []string `json:"organizations,omitempty"`
	Countries     []string `json:"countries,omitempty"`
	AnycastOrCDN  bool     `json:"anycast_or_cdn,omitempty"`
}

type DomainProviderSummary

type DomainProviderSummary struct {
	Registrar        string `json:"registrar,omitempty"`
	DNSProvider      string `json:"dns_provider,omitempty"`
	MailProvider     string `json:"mail_provider,omitempty"`
	CDNProvider      string `json:"cdn_provider,omitempty"`
	HostingProvider  string `json:"hosting_provider,omitempty"`
	ProxyDetected    bool   `json:"proxy_detected,omitempty"`
	BehindCloudflare bool   `json:"behind_cloudflare,omitempty"`
}

type DomainRegistrationInfo

type DomainRegistrationInfo struct {
	Registrar   string   `json:"registrar,omitempty"`
	CreatedDate string   `json:"created_date,omitempty"`
	UpdatedDate string   `json:"updated_date,omitempty"`
	ExpiryDate  string   `json:"expiry_date,omitempty"`
	NameServers []string `json:"name_servers,omitempty"`
}

type EmailAuthCheckRequest

type EmailAuthCheckRequest struct {
	Domain   string `json:"domain"`
	Selector string `json:"selector,omitempty"`
}

type EmailAuthCheckResponse

type EmailAuthCheckResponse struct {
	Domain          string          `json:"domain"`
	Grade           string          `json:"grade"`
	SPF             EmailAuthRecord `json:"spf"`
	DMARC           EmailAuthRecord `json:"dmarc"`
	DKIM            DKIMResult      `json:"dkim"`
	Recommendations []string        `json:"recommendations,omitempty"`
}

type EmailAuthRecord

type EmailAuthRecord struct {
	Present bool   `json:"present"`
	Record  string `json:"record,omitempty"`
	Mode    string `json:"mode,omitempty"`
}

type FundingInfo

type FundingInfo struct {
	LightningInvoice string `json:"lightning_invoice"`
	ArkAddress       string `json:"ark_address"`
	PaymentHash      string `json:"payment_hash"`
}

FundingInfo contains payment details for the consumer

type GeoReaders

type GeoReaders struct {
	City *geoip2.Reader
	ASN  *geoip2.Reader
}

GeoReaders holds opened DB-IP Lite/MMDB readers.

func OpenGeoDBs

func OpenGeoDBs(cityPath, asnPath string) *GeoReaders

OpenGeoDBs opens the configured MMDB GeoIP databases. Returns nil readers for any file that doesn't exist (handler will return an error on lookup).

func (*GeoReaders) Close

func (g *GeoReaders) Close()

Close closes the GeoIP database readers.

type HTTPBehaviorResponse

type HTTPBehaviorResponse struct {
	InitialURL    string   `json:"initial_url"`
	FinalURL      string   `json:"final_url,omitempty"`
	CanonicalHost string   `json:"canonical_host,omitempty"`
	RedirectCount int      `json:"redirect_count"`
	RedirectChain []string `json:"redirect_chain,omitempty"`
	StatusChain   []int    `json:"status_chain,omitempty"`
	HTTPSRedirect bool     `json:"https_redirect,omitempty"`
	WWWRedirect   bool     `json:"www_redirect,omitempty"`
}

type Handler

type Handler struct {
	DB   *database.DB
	Cfg  config.Config
	Bark *bark.Client
	Geo  *GeoReaders
}

Handler wraps the database connection so all handlers can use it

func New

func New(db *database.DB, cfg config.Config, barkClient *bark.Client, geo *GeoReaders) *Handler

New creates a new Handler with database access and optional bark client

func (*Handler) AIChat

func (h *Handler) AIChat(w http.ResponseWriter, r *http.Request)

func (*Handler) AITranslate

func (h *Handler) AITranslate(w http.ResponseWriter, r *http.Request)

func (*Handler) AXFRCheck

func (h *Handler) AXFRCheck(w http.ResponseWriter, r *http.Request)

func (*Handler) AdminOverview

func (h *Handler) AdminOverview(w http.ResponseWriter, r *http.Request)

func (*Handler) BTCPrice

func (h *Handler) BTCPrice(w http.ResponseWriter, r *http.Request)

BTCPrice handles /api/btc-price Cost: 1 sat

func (*Handler) BalanceCheck

func (h *Handler) BalanceCheck(w http.ResponseWriter, r *http.Request)

BalanceCheck handles GET /v1/balance

func (*Handler) BitcoinAddressValidate

func (h *Handler) BitcoinAddressValidate(w http.ResponseWriter, r *http.Request)

BitcoinAddressValidate handles /api/bitcoin-address Cost: 3 sats

func (*Handler) BitcoinNews

func (h *Handler) BitcoinNews(w http.ResponseWriter, r *http.Request)

func (*Handler) CVELookup

func (h *Handler) CVELookup(w http.ResponseWriter, r *http.Request)

func (*Handler) CVESearch

func (h *Handler) CVESearch(w http.ResponseWriter, r *http.Request)

func (*Handler) CreateSession

func (h *Handler) CreateSession(w http.ResponseWriter, r *http.Request)

CreateSession handles POST /v1/sessions

func (*Handler) DNSLookup

func (h *Handler) DNSLookup(w http.ResponseWriter, r *http.Request)

DNSLookup handles /api/dns-lookup Cost: 3 sats Runs: dig <domain> ANY +noall +answer

func (*Handler) DomainCheck

func (h *Handler) DomainCheck(w http.ResponseWriter, r *http.Request)

DomainCheck handles /api/domain-check Cost: configurable (default 3 sats)

func (*Handler) DomainIntel

func (h *Handler) DomainIntel(w http.ResponseWriter, r *http.Request)

func (*Handler) DownloadImage

func (h *Handler) DownloadImage(w http.ResponseWriter, r *http.Request)

func (*Handler) EmailAuthCheck

func (h *Handler) EmailAuthCheck(w http.ResponseWriter, r *http.Request)

func (*Handler) HashCrack

func (h *Handler) HashCrack(w http.ResponseWriter, r *http.Request)

func (*Handler) Headers

func (h *Handler) Headers(w http.ResponseWriter, r *http.Request)

Headers handles /api/headers Cost: 3 sats

func (*Handler) IPAbuseCheck

func (h *Handler) IPAbuseCheck(w http.ResponseWriter, r *http.Request)

func (*Handler) IPIntel

func (h *Handler) IPIntel(w http.ResponseWriter, r *http.Request)

func (*Handler) IPLookup

func (h *Handler) IPLookup(w http.ResponseWriter, r *http.Request)

IPLookup handles /api/ip-lookup Cost: 3 sats Uses self-hosted MMDB GeoIP databases

func (*Handler) ImageGenerate

func (h *Handler) ImageGenerate(w http.ResponseWriter, r *http.Request)

func (*Handler) PasteCreate

func (h *Handler) PasteCreate(w http.ResponseWriter, r *http.Request)

func (*Handler) PasteGet

func (h *Handler) PasteGet(w http.ResponseWriter, r *http.Request)

func (*Handler) PredictionMarketSearch

func (h *Handler) PredictionMarketSearch(w http.ResponseWriter, r *http.Request)

func (*Handler) QRGenerate

func (h *Handler) QRGenerate(w http.ResponseWriter, r *http.Request)

QRGenerate handles /api/qr-generate Cost: 2 sats

func (*Handler) RemoteJobSearch

func (h *Handler) RemoteJobSearch(w http.ResponseWriter, r *http.Request)

RemoteJobSearch handles /api/remote-job-search

func (*Handler) SSLCheck

func (h *Handler) SSLCheck(w http.ResponseWriter, r *http.Request)

SSLCheck handles /api/ssl-check Cost: 5 sats Uses Go's native TLS library — no need to shell out to openssl

func (*Handler) Screenshot

func (h *Handler) Screenshot(w http.ResponseWriter, r *http.Request)

func (*Handler) Translate

func (h *Handler) Translate(w http.ResponseWriter, r *http.Request)

func (*Handler) URLToMarkdown

func (h *Handler) URLToMarkdown(w http.ResponseWriter, r *http.Request)

URLToMarkdown handles /api/url-to-markdown Cost: 5 sats

func (*Handler) Weather

func (h *Handler) Weather(w http.ResponseWriter, r *http.Request)

Weather handles /api/weather Cost: 3 sats Proxies Open-Meteo's free API and bundles current + forecast

func (*Handler) Whois

func (h *Handler) Whois(w http.ResponseWriter, r *http.Request)

Whois handles /api/whois Cost: 5 sats

type HashCrackRequest

type HashCrackRequest struct {
	Hash string `json:"hash"`
	Type string `json:"type"`
	Mode string `json:"mode,omitempty"`
}

type HashCrackResponse

type HashCrackResponse struct {
	Hash      string `json:"hash"`
	Type      string `json:"type"`
	Mode      string `json:"mode"`
	Engine    string `json:"engine"`
	Ruleset   string `json:"ruleset"`
	Cracked   bool   `json:"cracked"`
	Plaintext string `json:"plaintext,omitempty"`
	TimedOut  bool   `json:"timed_out,omitempty"`
	ElapsedMs int    `json:"elapsed_ms"`
}

type HeadersRequest

type HeadersRequest struct {
	URL string `json:"url"`
}

HeadersRequest is what the consumer sends

type HeadersResponse

type HeadersResponse struct {
	URL             string            `json:"url"`
	StatusCode      int               `json:"status_code"`
	Server          string            `json:"server,omitempty"`
	SecurityHeaders []SecurityHeader  `json:"security_headers"`
	Score           int               `json:"score"` // 0-100
	Grade           string            `json:"grade"` // A, B, C, D, F
	AllHeaders      map[string]string `json:"all_headers"`
}

HeadersResponse is the full analysis

type IPAbuseCheckRequest

type IPAbuseCheckRequest struct {
	IP         string `json:"ip"`
	MaxAgeDays int    `json:"max_age_days,omitempty"`
}

type IPAbuseCheckResponse

type IPAbuseCheckResponse struct {
	IP                   string     `json:"ip"`
	AbuseConfidenceScore int        `json:"abuse_confidence_score"`
	CountryCode          string     `json:"country_code,omitempty"`
	UsageType            string     `json:"usage_type,omitempty"`
	ISP                  string     `json:"isp,omitempty"`
	Domain               string     `json:"domain,omitempty"`
	TotalReports         int        `json:"total_reports"`
	NumDistinctUsers     int        `json:"num_distinct_users"`
	LastReportedAt       *time.Time `json:"last_reported_at,omitempty"`
	IsWhitelisted        bool       `json:"is_whitelisted"`
	Source               string     `json:"source"`
	MaxAgeDays           int        `json:"max_age_days"`
}

type IPAbuseContact

type IPAbuseContact struct {
	Name            string   `json:"name,omitempty"`
	Org             string   `json:"org,omitempty"`
	Email           string   `json:"email,omitempty"`
	Phone           string   `json:"phone,omitempty"`
	Roles           []string `json:"roles,omitempty"`
	Source          string   `json:"source,omitempty"`
	IsAbuseSpecific bool     `json:"is_abuse_specific"`
}

type IPIntelRequest

type IPIntelRequest struct {
	IP         string `json:"ip"`
	MaxAgeDays int    `json:"max_age_days,omitempty"`
}

type IPIntelResponse

type IPIntelResponse struct {
	Lookup           *IPResponse           `json:"lookup"`
	IP               string                `json:"ip"`
	ReverseDNS       []string              `json:"reverse_dns,omitempty"`
	ASNNumber        int                   `json:"asn_number,omitempty"`
	NetworkType      string                `json:"network_type,omitempty"`
	ReportedRecently bool                  `json:"reported_recently"`
	RiskLabel        string                `json:"risk_label"`
	RiskReason       string                `json:"risk_reason"`
	Abuse            *IPAbuseCheckResponse `json:"abuse"`
	URLhausHost      *IPURLhausHostSummary `json:"urlhaus_host,omitempty"`
	AbuseContact     *IPAbuseContact       `json:"abuse_contact,omitempty"`
	AbuseReportNote  string                `json:"abuse_reporting_note,omitempty"`
}

type IPRequest

type IPRequest struct {
	IP string `json:"ip"`
}

IPRequest is what the consumer sends

type IPResponse

type IPResponse struct {
	IP                  string  `json:"ip"`
	Country             string  `json:"country"`
	CountryCode         string  `json:"country_code"`
	Region              string  `json:"region"`
	City                string  `json:"city"`
	ApproximateLocation string  `json:"approximate_location,omitempty"`
	Lat                 float64 `json:"lat"`
	Lon                 float64 `json:"lon"`
	GoogleMapsURL       string  `json:"google_maps_url,omitempty"`
	ISP                 string  `json:"isp"`
	Org                 string  `json:"org"`
	AS                  string  `json:"as"`
}

IPResponse is the geolocation data

type IPURLhausHostSummary

type IPURLhausHostSummary struct {
	Listed        bool     `json:"listed"`
	FirstSeen     string   `json:"first_seen,omitempty"`
	URLCount      int      `json:"url_count,omitempty"`
	SpamhausDBL   string   `json:"spamhaus_dbl,omitempty"`
	SURBL         string   `json:"surbl,omitempty"`
	SampleThreats []string `json:"sample_threats,omitempty"`
	SampleTags    []string `json:"sample_tags,omitempty"`
	Source        string   `json:"source"`
}

type ImageGenerateRequest

type ImageGenerateRequest struct {
	Prompt string `json:"prompt"`
}

type ImageGenerateResponse

type ImageGenerateResponse struct {
	Prompt      string `json:"prompt"`
	Width       int    `json:"width"`
	Height      int    `json:"height"`
	Steps       int    `json:"steps"`
	Seed        int64  `json:"seed"`
	MimeType    string `json:"mime_type"`
	DownloadURL string `json:"download_url"`
	ExpiresAt   string `json:"expires_at"`
}

type LocationInfo

type LocationInfo struct {
	Lat  float64 `json:"lat"`
	Lon  float64 `json:"lon"`
	Name string  `json:"name,omitempty"`
}

type MarkdownRequest

type MarkdownRequest struct {
	URL string `json:"url"`
}

MarkdownRequest is what the consumer sends

type MarkdownResponse

type MarkdownResponse struct {
	URL      string `json:"url"`
	Title    string `json:"title"`
	Markdown string `json:"markdown"`
	Excerpt  string `json:"excerpt,omitempty"`
}

MarkdownResponse is what we return

type PasteCreateRequest

type PasteCreateRequest struct {
	Content       *string         `json:"content,omitempty"`
	JSON          json.RawMessage `json:"json,omitempty"`
	TTLSeconds    int             `json:"ttl_seconds,omitempty"`
	BurnAfterRead bool            `json:"burn_after_read,omitempty"`
	MaxViews      *int            `json:"max_views,omitempty"`
}

type PasteCreateResponse

type PasteCreateResponse struct {
	ID             string `json:"id"`
	URL            string `json:"url"`
	ContentKind    string `json:"content_kind"`
	SizeBytes      int    `json:"size_bytes"`
	TTLSeconds     int    `json:"ttl_seconds"`
	BurnAfterRead  bool   `json:"burn_after_read"`
	MaxViews       *int   `json:"max_views,omitempty"`
	ViewsRemaining *int   `json:"views_remaining,omitempty"`
	ExpiresAt      string `json:"expires_at"`
}

type PasteReadResponse

type PasteReadResponse struct {
	ID             string `json:"id"`
	ContentKind    string `json:"content_kind"`
	Content        string `json:"content"`
	SizeBytes      int    `json:"size_bytes"`
	BurnAfterRead  bool   `json:"burn_after_read"`
	MaxViews       *int   `json:"max_views,omitempty"`
	ViewCount      int    `json:"view_count"`
	ViewsRemaining *int   `json:"views_remaining,omitempty"`
	CreatedAt      string `json:"created_at"`
	ExpiresAt      string `json:"expires_at"`
}

type PredictionMarketSearchRequest

type PredictionMarketSearchRequest struct {
	Query string `json:"query"`
	Limit int    `json:"limit,omitempty"`
}

type PredictionMarketSearchResponse

type PredictionMarketSearchResponse struct {
	Query    string                         `json:"query"`
	Platform string                         `json:"platform"`
	Results  []PredictionMarketSearchResult `json:"results"`
}

type PredictionMarketSearchResult

type PredictionMarketSearchResult struct {
	MarketID    string  `json:"market_id"`
	EventID     string  `json:"event_id,omitempty"`
	Title       string  `json:"title"`
	EventTitle  string  `json:"event_title,omitempty"`
	Platform    string  `json:"platform"`
	Status      string  `json:"status"`
	Probability float64 `json:"probability,omitempty"`
	VolumeUSD   float64 `json:"volume_usd,omitempty"`
	CloseTime   string  `json:"close_time,omitempty"`
	URL         string  `json:"url,omitempty"`
}

type QRRequest

type QRRequest struct {
	Data string `json:"data"`           // The text/URL to encode
	Size int    `json:"size,omitempty"` // Image size in pixels (default 256, max 1024)
}

QRRequest is what the consumer sends

type QRResponse

type QRResponse struct {
	Data     string `json:"data"`      // The input data echoed back
	Format   string `json:"format"`    // "png"
	Size     int    `json:"size"`      // Actual size used
	ImageB64 string `json:"image_b64"` // Base64-encoded PNG image
	DataURI  string `json:"data_uri"`  // Ready-to-use data URI for <img src="">
}

QRResponse is what we return

type RemoteJobSearchEntry

type RemoteJobSearchEntry struct {
	ID                        int        `json:"id"`
	URL                       string     `json:"url"`
	Title                     string     `json:"title"`
	CompanyName               string     `json:"company_name"`
	Category                  string     `json:"category,omitempty"`
	Tags                      []string   `json:"tags,omitempty"`
	JobType                   string     `json:"job_type,omitempty"`
	PublicationDate           *time.Time `json:"publication_date,omitempty"`
	CandidateRequiredLocation string     `json:"candidate_required_location,omitempty"`
	Salary                    string     `json:"salary,omitempty"`
	DescriptionText           string     `json:"description_text,omitempty"`
}

type RemoteJobSearchResponse

type RemoteJobSearchResponse struct {
	Search        string                 `json:"search,omitempty"`
	Category      string                 `json:"category,omitempty"`
	CompanyName   string                 `json:"company_name,omitempty"`
	Limit         int                    `json:"limit"`
	Source        string                 `json:"source"`
	ProviderNote  string                 `json:"provider_note,omitempty"`
	JobCount      int                    `json:"job_count"`
	TotalJobCount int                    `json:"total_job_count,omitempty"`
	Jobs          []RemoteJobSearchEntry `json:"jobs"`
}

type RobotsTXTResponse

type RobotsTXTResponse struct {
	Present    bool     `json:"present"`
	SourceURL  string   `json:"source_url,omitempty"`
	UserAgents []string `json:"user_agents,omitempty"`
	Allow      []string `json:"allow,omitempty"`
	Disallow   []string `json:"disallow,omitempty"`
	Sitemaps   []string `json:"sitemaps,omitempty"`
	CrawlDelay string   `json:"crawl_delay,omitempty"`
	Host       string   `json:"host,omitempty"`
}

type SSLRequest

type SSLRequest struct {
	Domain string `json:"domain"`
	Port   int    `json:"port,omitempty"` // defaults to 443
}

SSLRequest is what the consumer sends

type SSLResponse

type SSLResponse struct {
	Domain        string   `json:"domain"`
	Valid         bool     `json:"valid"`
	Issuer        string   `json:"issuer"`
	Subject       string   `json:"subject"`
	NotBefore     string   `json:"not_before"`
	NotAfter      string   `json:"not_after"`
	DaysRemaining int      `json:"days_remaining"`
	Protocol      string   `json:"protocol"`
	CipherSuite   string   `json:"cipher_suite,omitempty"`
	SANs          []string `json:"sans,omitempty"`
	Chain         []string `json:"chain,omitempty"`
	Expired       bool     `json:"expired"`
}

SSLResponse is the certificate analysis

type ScreenshotRequest

type ScreenshotRequest struct {
	URL string `json:"url"`
}

type ScreenshotResponse

type ScreenshotResponse struct {
	URL         string `json:"url"`
	FinalURL    string `json:"final_url"`
	Width       int    `json:"width"`
	Height      int    `json:"height"`
	MimeType    string `json:"mime_type"`
	DownloadURL string `json:"download_url"`
	ExpiresAt   string `json:"expires_at"`
}

type SecurityHeader

type SecurityHeader struct {
	Header  string `json:"header"`
	Value   string `json:"value"`
	Present bool   `json:"present"`
	Rating  string `json:"rating"` // "good", "warning", "bad", "info"
	Note    string `json:"note"`
}

SecurityHeader is a single header check result

type SecurityTXTResponse

type SecurityTXTResponse struct {
	Present            bool     `json:"present"`
	SourceURL          string   `json:"source_url,omitempty"`
	Canonical          []string `json:"canonical,omitempty"`
	Contacts           []string `json:"contacts,omitempty"`
	Emails             []string `json:"emails,omitempty"`
	Policy             []string `json:"policy,omitempty"`
	Hiring             []string `json:"hiring,omitempty"`
	Encryption         []string `json:"encryption,omitempty"`
	Acknowledgments    []string `json:"acknowledgments,omitempty"`
	PreferredLanguages []string `json:"preferred_languages,omitempty"`
	CSAF               []string `json:"csaf,omitempty"`
	Expires            string   `json:"expires,omitempty"`
}

type SessionRequest

type SessionRequest struct {
	AmountSats int64 `json:"amount_sats,omitempty"`
}

SessionRequest is the optional body for session creation

type SessionResponse

type SessionResponse struct {
	Token       string `json:"token"`
	BalanceSats int64  `json:"balance_sats"`
	Status      string `json:"status"`
	Message     string `json:"message"`
}

SessionResponse is returned when creating a session in test mode

type TechFingerprintResponse

type TechFingerprintResponse struct {
	CMS       string   `json:"cms,omitempty"`
	Frontend  string   `json:"frontend,omitempty"`
	Ecommerce string   `json:"ecommerce,omitempty"`
	Generator string   `json:"generator,omitempty"`
	Server    string   `json:"server,omitempty"`
	Detected  []string `json:"detected,omitempty"`
	FinalURL  string   `json:"final_url,omitempty"`
}

type TranslateRequest

type TranslateRequest struct {
	Text           string `json:"text"`
	TargetLanguage string `json:"target_language,omitempty"`
	SourceLanguage string `json:"source_language,omitempty"`
}

type TranslateResponse

type TranslateResponse struct {
	Text               string `json:"text"`
	TranslatedText     string `json:"translated_text"`
	TargetLanguage     string `json:"target_language"`
	SourceLanguage     string `json:"source_language"`
	DetectedLanguage   string `json:"detected_language,omitempty"`
	DetectedConfidence int    `json:"detected_confidence,omitempty"`
}

type WeatherRequest

type WeatherRequest struct {
	Lat  float64 `json:"lat"`
	Lon  float64 `json:"lon"`
	City string  `json:"city,omitempty"` // optional - we'll geocode it
}

WeatherRequest is what the consumer sends

type WeatherResponse

type WeatherResponse struct {
	Location LocationInfo `json:"location"`
	Current  interface{}  `json:"current"`
	Hourly   interface{}  `json:"hourly,omitempty"`
	Daily    interface{}  `json:"daily,omitempty"`
}

WeatherResponse is the combined weather data

type WhoisRequest

type WhoisRequest struct {
	Domain string `json:"domain"`
}

WhoisRequest is what the consumer sends

type WhoisResponse

type WhoisResponse struct {
	Domain      string            `json:"domain"`
	Registrar   string            `json:"registrar,omitempty"`
	CreatedDate string            `json:"created_date,omitempty"`
	ExpiryDate  string            `json:"expiry_date,omitempty"`
	UpdatedDate string            `json:"updated_date,omitempty"`
	NameServers []string          `json:"name_servers,omitempty"`
	Status      []string          `json:"status,omitempty"`
	Parsed      map[string]string `json:"parsed"`
}

WhoisResponse is the parsed WHOIS data

Jump to

Keyboard shortcuts

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