instant

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: Apache-2.0, BSD-3-Clause, MIT Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ASCIIHandler

type ASCIIHandler struct {
	// contains filtered or unexported fields
}

ASCIIHandler handles ASCII art text generation

func NewASCIIHandler

func NewASCIIHandler() *ASCIIHandler

NewASCIIHandler creates a new ASCII art handler

func (*ASCIIHandler) CanHandle

func (h *ASCIIHandler) CanHandle(query string) bool

func (*ASCIIHandler) Handle

func (h *ASCIIHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*ASCIIHandler) Name

func (h *ASCIIHandler) Name() string

func (*ASCIIHandler) Patterns

func (h *ASCIIHandler) Patterns() []*regexp.Regexp

type ASNHandler

type ASNHandler struct {
	// contains filtered or unexported fields
}

ASNHandler handles Autonomous System Number lookups

func NewASNHandler

func NewASNHandler() *ASNHandler

NewASNHandler creates a new ASN handler

func (*ASNHandler) CanHandle

func (h *ASNHandler) CanHandle(query string) bool

func (*ASNHandler) Handle

func (h *ASNHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*ASNHandler) Name

func (h *ASNHandler) Name() string

func (*ASNHandler) Patterns

func (h *ASNHandler) Patterns() []*regexp.Regexp

type Answer

type Answer struct {
	Type        AnswerType             `json:"type"`
	Query       string                 `json:"query"`
	Title       string                 `json:"title"`
	Content     string                 `json:"content"`
	Data        map[string]interface{} `json:"data,omitempty"`
	Source      string                 `json:"source,omitempty"`
	SourceURL   string                 `json:"source_url,omitempty"`
	RelatedHTML string                 `json:"related_html,omitempty"`
}

Answer represents an instant answer result

type AnswerType

type AnswerType string

AnswerType represents the type of instant answer

const (
	AnswerTypeDefinition AnswerType = "definition"
	AnswerTypeDictionary AnswerType = "dictionary"
	AnswerTypeSynonym    AnswerType = "synonym"
	AnswerTypeAntonym    AnswerType = "antonym"
	AnswerTypeMath       AnswerType = "math"
	AnswerTypeConvert    AnswerType = "convert"
	AnswerTypeTime       AnswerType = "time"
	AnswerTypeDate       AnswerType = "date"
	AnswerTypeCalendar   AnswerType = "calendar"
	AnswerTypeTimezone   AnswerType = "timezone"
	AnswerTypeStopwatch  AnswerType = "stopwatch"
	AnswerTypeIP         AnswerType = "ip"
	AnswerTypeHash       AnswerType = "hash"
	AnswerTypeBase64     AnswerType = "base64"
	AnswerTypeURL        AnswerType = "url"
	AnswerTypeColor      AnswerType = "color"
	AnswerTypeUUID       AnswerType = "uuid"
	AnswerTypeRandom     AnswerType = "random"
	AnswerTypePassword   AnswerType = "password"
	AnswerTypeQR         AnswerType = "qr"
	AnswerTypeASCII      AnswerType = "ascii"
	AnswerTypeCase       AnswerType = "case"
	AnswerTypeSlug       AnswerType = "slug"
	AnswerTypeJSON       AnswerType = "json"
	AnswerTypeYAML       AnswerType = "yaml"
	AnswerTypeEscape     AnswerType = "escape"
	AnswerTypeASN        AnswerType = "asn"
	AnswerTypeWHOIS      AnswerType = "whois"
	AnswerTypeDNS        AnswerType = "dns"
	AnswerTypeBeautify   AnswerType = "beautify"

	// Direct answer types (type:query pattern)
	AnswerTypeTLDR      AnswerType = "tldr"
	AnswerTypeHTTPCode  AnswerType = "httpcode"
	AnswerTypePort      AnswerType = "port"
	AnswerTypeCron      AnswerType = "cron"
	AnswerTypeChmod     AnswerType = "chmod"
	AnswerTypeTimestamp AnswerType = "timestamp"
	AnswerTypeSubnet    AnswerType = "subnet"
	AnswerTypeJWT       AnswerType = "jwt"

	// Web analysis types
	AnswerTypeFeed       AnswerType = "feed"
	AnswerTypeTech       AnswerType = "tech"
	AnswerTypeSitemap    AnswerType = "sitemap"
	AnswerTypeSafe       AnswerType = "safe"
	AnswerTypeEmoji      AnswerType = "emoji"
	AnswerTypeHTMLEntity AnswerType = "htmlentity"
	AnswerTypeUnicode    AnswerType = "unicode"
)
const AnswerTypeCVE AnswerType = "cve"

AnswerTypeCVE is the answer type for CVE lookups

const AnswerTypeCert AnswerType = "cert"

AnswerTypeCert is the answer type for certificate information

const AnswerTypeCheat AnswerType = "cheat"

AnswerTypeCheat is the answer type for cheatsheet lookups

const AnswerTypeExpand AnswerType = "expand"

AnswerTypeExpand is the answer type for URL expansion

const AnswerTypeHeaders AnswerType = "headers"

AnswerTypeHeaders is the answer type for HTTP headers analysis

const AnswerTypeMan AnswerType = "man"

AnswerTypeMan is the answer type for man page lookups

const AnswerTypePkg AnswerType = "pkg"

AnswerTypePkg is the answer type for package lookups

const AnswerTypeRFC AnswerType = "rfc"

AnswerTypeRFC is the answer type for RFC lookups

const AnswerTypeRegex AnswerType = "regex"

AnswerTypeRegex is the answer type for regex explanations

const AnswerTypeResolve AnswerType = "resolve"

AnswerTypeResolve is the answer type for DNS resolution

const AnswerTypeRobots AnswerType = "robots"

AnswerTypeRobots is the answer type for robots.txt analysis

type AntonymHandler

type AntonymHandler struct {
	// contains filtered or unexported fields
}

AntonymHandler handles antonym lookups

func NewAntonymHandler

func NewAntonymHandler() *AntonymHandler

NewAntonymHandler creates a new antonym handler

func (*AntonymHandler) CanHandle

func (h *AntonymHandler) CanHandle(query string) bool

func (*AntonymHandler) Handle

func (h *AntonymHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*AntonymHandler) Name

func (h *AntonymHandler) Name() string

func (*AntonymHandler) Patterns

func (h *AntonymHandler) Patterns() []*regexp.Regexp

type Base64Handler

type Base64Handler struct {
	// contains filtered or unexported fields
}

Base64Handler handles base64 encoding/decoding

func NewBase64Handler

func NewBase64Handler() *Base64Handler

func (*Base64Handler) CanHandle

func (h *Base64Handler) CanHandle(query string) bool

func (*Base64Handler) Handle

func (h *Base64Handler) Handle(ctx context.Context, query string) (*Answer, error)

func (*Base64Handler) Name

func (h *Base64Handler) Name() string

func (*Base64Handler) Patterns

func (h *Base64Handler) Patterns() []*regexp.Regexp

type BeautifyConfig

type BeautifyConfig struct {
	IndentSize int
	UseTabs    bool
}

BeautifyConfig holds beautification settings

func DefaultBeautifyConfig

func DefaultBeautifyConfig() *BeautifyConfig

DefaultBeautifyConfig returns default beautification config

type BeautifyHandler

type BeautifyHandler struct {
	// contains filtered or unexported fields
}

BeautifyHandler handles code beautification queries

func NewBeautifyHandler

func NewBeautifyHandler() *BeautifyHandler

NewBeautifyHandler creates a new code beautify handler

func (*BeautifyHandler) CanHandle

func (h *BeautifyHandler) CanHandle(query string) bool

func (*BeautifyHandler) Handle

func (h *BeautifyHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*BeautifyHandler) Name

func (h *BeautifyHandler) Name() string

func (*BeautifyHandler) Patterns

func (h *BeautifyHandler) Patterns() []*regexp.Regexp

type CVEHandler

type CVEHandler struct {
	// contains filtered or unexported fields
}

CVEHandler handles CVE (Common Vulnerabilities and Exposures) lookups

func NewCVEHandler

func NewCVEHandler() *CVEHandler

NewCVEHandler creates a new CVE handler

func (*CVEHandler) CanHandle

func (h *CVEHandler) CanHandle(query string) bool

func (*CVEHandler) Handle

func (h *CVEHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*CVEHandler) Name

func (h *CVEHandler) Name() string

func (*CVEHandler) Patterns

func (h *CVEHandler) Patterns() []*regexp.Regexp

type CVEItem

type CVEItem struct {
	ID           string `json:"id"`
	Published    string `json:"published"`
	LastModified string `json:"lastModified"`
	Descriptions []struct {
		Lang  string `json:"lang"`
		Value string `json:"value"`
	} `json:"descriptions"`
	Metrics struct {
		CVSSMetricV31 []struct {
			CVSSData struct {
				Version      string  `json:"version"`
				VectorString string  `json:"vectorString"`
				BaseScore    float64 `json:"baseScore"`
				BaseSeverity string  `json:"baseSeverity"`
			} `json:"cvssData"`
		} `json:"cvssMetricV31"`
		CVSSMetricV2 []struct {
			CVSSData struct {
				Version      string  `json:"version"`
				VectorString string  `json:"vectorString"`
				BaseScore    float64 `json:"baseScore"`
			} `json:"cvssData"`
			BaseSeverity string `json:"baseSeverity"`
		} `json:"cvssMetricV2"`
	} `json:"metrics"`
	References []struct {
		URL    string   `json:"url"`
		Source string   `json:"source"`
		Tags   []string `json:"tags"`
	} `json:"references"`
}

type CalendarHandler

type CalendarHandler struct {
	// contains filtered or unexported fields
}

CalendarHandler handles date calculations and queries

func NewCalendarHandler

func NewCalendarHandler() *CalendarHandler

NewCalendarHandler creates a new calendar handler

func (*CalendarHandler) CanHandle

func (h *CalendarHandler) CanHandle(query string) bool

func (*CalendarHandler) Handle

func (h *CalendarHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*CalendarHandler) Name

func (h *CalendarHandler) Name() string

func (*CalendarHandler) Patterns

func (h *CalendarHandler) Patterns() []*regexp.Regexp

type CaseHandler

type CaseHandler struct {
	// contains filtered or unexported fields
}

CaseHandler handles text case conversions

func NewCaseHandler

func NewCaseHandler() *CaseHandler

NewCaseHandler creates a new case converter handler

func (*CaseHandler) CanHandle

func (h *CaseHandler) CanHandle(query string) bool

func (*CaseHandler) Handle

func (h *CaseHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*CaseHandler) Name

func (h *CaseHandler) Name() string

func (*CaseHandler) Patterns

func (h *CaseHandler) Patterns() []*regexp.Regexp

type CertHandler

type CertHandler struct {
	// contains filtered or unexported fields
}

CertHandler handles SSL certificate information queries

func NewCertHandler

func NewCertHandler() *CertHandler

NewCertHandler creates a new certificate handler

func (*CertHandler) CanHandle

func (h *CertHandler) CanHandle(query string) bool

func (*CertHandler) Handle

func (h *CertHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*CertHandler) Name

func (h *CertHandler) Name() string

func (*CertHandler) Patterns

func (h *CertHandler) Patterns() []*regexp.Regexp

type CertInfo

type CertInfo struct {
	Subject    string    `json:"subject"`
	Issuer     string    `json:"issuer"`
	ValidFrom  time.Time `json:"valid_from"`
	ValidUntil time.Time `json:"valid_until"`
	DaysLeft   int       `json:"days_left"`
	IsValid    bool      `json:"is_valid"`
}

CertInfo represents SSL certificate information

type CheatHandler

type CheatHandler struct {
	// contains filtered or unexported fields
}

CheatHandler handles cheatsheet lookups from cheat.sh

func NewCheatHandler

func NewCheatHandler() *CheatHandler

NewCheatHandler creates a new cheatsheet handler

func (*CheatHandler) CanHandle

func (h *CheatHandler) CanHandle(query string) bool

func (*CheatHandler) Handle

func (h *CheatHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*CheatHandler) Name

func (h *CheatHandler) Name() string

func (*CheatHandler) Patterns

func (h *CheatHandler) Patterns() []*regexp.Regexp

type ChmodHandler

type ChmodHandler struct {
	// contains filtered or unexported fields
}

ChmodHandler calculates Unix file permissions

func NewChmodHandler

func NewChmodHandler() *ChmodHandler

NewChmodHandler creates a new chmod handler

func (*ChmodHandler) CanHandle

func (h *ChmodHandler) CanHandle(query string) bool

func (*ChmodHandler) Handle

func (h *ChmodHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*ChmodHandler) Name

func (h *ChmodHandler) Name() string

func (*ChmodHandler) Patterns

func (h *ChmodHandler) Patterns() []*regexp.Regexp

type ColorHandler

type ColorHandler struct {
	// contains filtered or unexported fields
}

ColorHandler handles color conversions

func NewColorHandler

func NewColorHandler() *ColorHandler

func (*ColorHandler) CanHandle

func (h *ColorHandler) CanHandle(query string) bool

func (*ColorHandler) Handle

func (h *ColorHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*ColorHandler) Name

func (h *ColorHandler) Name() string

func (*ColorHandler) Patterns

func (h *ColorHandler) Patterns() []*regexp.Regexp

type ConvertHandler

type ConvertHandler struct {
	// contains filtered or unexported fields
}

ConvertHandler handles unit conversions

func NewConvertHandler

func NewConvertHandler() *ConvertHandler

NewConvertHandler creates a new conversion handler

func (*ConvertHandler) CanHandle

func (h *ConvertHandler) CanHandle(query string) bool

func (*ConvertHandler) Handle

func (h *ConvertHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*ConvertHandler) Name

func (h *ConvertHandler) Name() string

func (*ConvertHandler) Patterns

func (h *ConvertHandler) Patterns() []*regexp.Regexp

type CronHandler

type CronHandler struct {
	// contains filtered or unexported fields
}

CronHandler explains cron expressions

func NewCronHandler

func NewCronHandler() *CronHandler

NewCronHandler creates a new cron handler

func (*CronHandler) CanHandle

func (h *CronHandler) CanHandle(query string) bool

func (*CronHandler) Handle

func (h *CronHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*CronHandler) Name

func (h *CronHandler) Name() string

func (*CronHandler) Patterns

func (h *CronHandler) Patterns() []*regexp.Regexp

type DNSHandler

type DNSHandler struct {
	// contains filtered or unexported fields
}

DNSHandler handles DNS record lookups

func NewDNSHandler

func NewDNSHandler() *DNSHandler

NewDNSHandler creates a new DNS lookup handler

func (*DNSHandler) CanHandle

func (h *DNSHandler) CanHandle(query string) bool

func (*DNSHandler) Handle

func (h *DNSHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*DNSHandler) Name

func (h *DNSHandler) Name() string

func (*DNSHandler) Patterns

func (h *DNSHandler) Patterns() []*regexp.Regexp

type DNSRecord

type DNSRecord struct {
	Type  string `json:"type"`
	Value string `json:"value"`
	TTL   int    `json:"ttl,omitempty"`
}

DNSRecord represents a DNS record

type DefinitionHandler

type DefinitionHandler struct {
	// contains filtered or unexported fields
}

DefinitionHandler handles word definitions

func NewDefinitionHandler

func NewDefinitionHandler() *DefinitionHandler

NewDefinitionHandler creates a new definition handler

func (*DefinitionHandler) CanHandle

func (h *DefinitionHandler) CanHandle(query string) bool

func (*DefinitionHandler) Handle

func (h *DefinitionHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*DefinitionHandler) Name

func (h *DefinitionHandler) Name() string

func (*DefinitionHandler) Patterns

func (h *DefinitionHandler) Patterns() []*regexp.Regexp

type DictionaryHandler

type DictionaryHandler struct {
	*DefinitionHandler
}

DictionaryHandler is an alias for DefinitionHandler with different patterns

func NewDictionaryHandler

func NewDictionaryHandler() *DictionaryHandler

NewDictionaryHandler creates a new dictionary handler

func (*DictionaryHandler) Name

func (h *DictionaryHandler) Name() string

type DirectAnswerManager

type DirectAnswerManager struct {
	// contains filtered or unexported fields
}

DirectAnswerManager handles "type:query" pattern instant answers

func NewDirectAnswerManager

func NewDirectAnswerManager() *DirectAnswerManager

NewDirectAnswerManager creates a new direct answer manager with all handlers

func (*DirectAnswerManager) GetHandlers

func (m *DirectAnswerManager) GetHandlers() []Handler

GetHandlers returns all registered handlers

func (*DirectAnswerManager) Process

func (m *DirectAnswerManager) Process(ctx context.Context, query string) (*Answer, error)

Process checks if query matches any direct answer and returns the result

func (*DirectAnswerManager) Register

func (m *DirectAnswerManager) Register(h Handler)

Register adds a handler to the manager

type EmojiHandler

type EmojiHandler struct {
	// contains filtered or unexported fields
}

EmojiHandler handles emoji lookups by name/keyword

func NewEmojiHandler

func NewEmojiHandler() *EmojiHandler

NewEmojiHandler creates a new emoji handler

func (*EmojiHandler) CanHandle

func (h *EmojiHandler) CanHandle(query string) bool

func (*EmojiHandler) Handle

func (h *EmojiHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*EmojiHandler) Name

func (h *EmojiHandler) Name() string

func (*EmojiHandler) Patterns

func (h *EmojiHandler) Patterns() []*regexp.Regexp

type EmojiInfo

type EmojiInfo struct {
	Emoji    string
	Name     string
	Keywords []string
	Category string
}

EmojiInfo contains information about an emoji

type EscapeHandler

type EscapeHandler struct {
	// contains filtered or unexported fields
}

EscapeHandler handles string escaping for various formats

func NewEscapeHandler

func NewEscapeHandler() *EscapeHandler

NewEscapeHandler creates a new escape handler

func (*EscapeHandler) CanHandle

func (h *EscapeHandler) CanHandle(query string) bool

func (*EscapeHandler) Handle

func (h *EscapeHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*EscapeHandler) Name

func (h *EscapeHandler) Name() string

func (*EscapeHandler) Patterns

func (h *EscapeHandler) Patterns() []*regexp.Regexp

type ExpandHandler

type ExpandHandler struct {
	// contains filtered or unexported fields
}

ExpandHandler handles URL expansion by following redirects

func NewExpandHandler

func NewExpandHandler() *ExpandHandler

NewExpandHandler creates a new URL expansion handler

func (*ExpandHandler) CanHandle

func (h *ExpandHandler) CanHandle(query string) bool

func (*ExpandHandler) Handle

func (h *ExpandHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*ExpandHandler) Name

func (h *ExpandHandler) Name() string

func (*ExpandHandler) Patterns

func (h *ExpandHandler) Patterns() []*regexp.Regexp

type FeedHandler

type FeedHandler struct {
	// contains filtered or unexported fields
}

FeedHandler discovers RSS/Atom feeds on a website

func NewFeedHandler

func NewFeedHandler() *FeedHandler

NewFeedHandler creates a new feed discovery handler

func (*FeedHandler) CanHandle

func (h *FeedHandler) CanHandle(query string) bool

func (*FeedHandler) Handle

func (h *FeedHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*FeedHandler) Name

func (h *FeedHandler) Name() string

func (*FeedHandler) Patterns

func (h *FeedHandler) Patterns() []*regexp.Regexp

type FeedInfo

type FeedInfo struct {
	Title string `json:"title"`
	URL   string `json:"url"`
	Type  string `json:"type"` // "rss" or "atom"
}

FeedInfo represents a discovered feed

type HTMLEntityHandler

type HTMLEntityHandler struct {
	// contains filtered or unexported fields
}

HTMLEntityHandler handles HTML entity encoding/decoding

func NewHTMLEntityHandler

func NewHTMLEntityHandler() *HTMLEntityHandler

NewHTMLEntityHandler creates a new HTML entity handler

func (*HTMLEntityHandler) CanHandle

func (h *HTMLEntityHandler) CanHandle(query string) bool

func (*HTMLEntityHandler) Handle

func (h *HTMLEntityHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*HTMLEntityHandler) Name

func (h *HTMLEntityHandler) Name() string

func (*HTMLEntityHandler) Patterns

func (h *HTMLEntityHandler) Patterns() []*regexp.Regexp

type HTTPCodeHandler

type HTTPCodeHandler struct {
	// contains filtered or unexported fields
}

HTTPCodeHandler explains HTTP status codes

func NewHTTPCodeHandler

func NewHTTPCodeHandler() *HTTPCodeHandler

NewHTTPCodeHandler creates a new HTTP code handler

func (*HTTPCodeHandler) CanHandle

func (h *HTTPCodeHandler) CanHandle(query string) bool

func (*HTTPCodeHandler) Handle

func (h *HTTPCodeHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*HTTPCodeHandler) Name

func (h *HTTPCodeHandler) Name() string

func (*HTTPCodeHandler) Patterns

func (h *HTTPCodeHandler) Patterns() []*regexp.Regexp

type Handler

type Handler interface {
	// Name returns the handler name
	Name() string
	// Patterns returns regex patterns that trigger this handler
	Patterns() []*regexp.Regexp
	// CanHandle checks if query matches this handler
	CanHandle(query string) bool
	// Handle processes the query and returns an answer
	Handle(ctx context.Context, query string) (*Answer, error)
}

Handler interface for instant answer handlers

type HashHandler

type HashHandler struct {
	// contains filtered or unexported fields
}

HashHandler handles hash generation

func NewHashHandler

func NewHashHandler() *HashHandler

func (*HashHandler) CanHandle

func (h *HashHandler) CanHandle(query string) bool

func (*HashHandler) Handle

func (h *HashHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*HashHandler) Name

func (h *HashHandler) Name() string

func (*HashHandler) Patterns

func (h *HashHandler) Patterns() []*regexp.Regexp

type HeadersHandler

type HeadersHandler struct {
	// contains filtered or unexported fields
}

HeadersHandler handles HTTP response header queries

func NewHeadersHandler

func NewHeadersHandler() *HeadersHandler

NewHeadersHandler creates a new headers handler

func (*HeadersHandler) CanHandle

func (h *HeadersHandler) CanHandle(query string) bool

func (*HeadersHandler) Handle

func (h *HeadersHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*HeadersHandler) Name

func (h *HeadersHandler) Name() string

func (*HeadersHandler) Patterns

func (h *HeadersHandler) Patterns() []*regexp.Regexp

type IPHandler

type IPHandler struct {
	// contains filtered or unexported fields
}

IPHandler handles IP address lookups

func NewIPHandler

func NewIPHandler() *IPHandler

func (*IPHandler) CanHandle

func (h *IPHandler) CanHandle(query string) bool

func (*IPHandler) Handle

func (h *IPHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*IPHandler) Name

func (h *IPHandler) Name() string

func (*IPHandler) Patterns

func (h *IPHandler) Patterns() []*regexp.Regexp

type JSONHandler

type JSONHandler struct {
	// contains filtered or unexported fields
}

JSONHandler handles JSON formatting and validation

func NewJSONHandler

func NewJSONHandler() *JSONHandler

NewJSONHandler creates a new JSON handler

func (*JSONHandler) CanHandle

func (h *JSONHandler) CanHandle(query string) bool

func (*JSONHandler) Handle

func (h *JSONHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*JSONHandler) Name

func (h *JSONHandler) Name() string

func (*JSONHandler) Patterns

func (h *JSONHandler) Patterns() []*regexp.Regexp

type JWTHandler

type JWTHandler struct {
	// contains filtered or unexported fields
}

JWTHandler decodes JWT tokens

func NewJWTHandler

func NewJWTHandler() *JWTHandler

NewJWTHandler creates a new JWT handler

func (*JWTHandler) CanHandle

func (h *JWTHandler) CanHandle(query string) bool

func (*JWTHandler) Handle

func (h *JWTHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*JWTHandler) Name

func (h *JWTHandler) Name() string

func (*JWTHandler) Patterns

func (h *JWTHandler) Patterns() []*regexp.Regexp

type ManHandler

type ManHandler struct {
	// contains filtered or unexported fields
}

ManHandler handles man page lookups using man.cx API

func NewManHandler

func NewManHandler() *ManHandler

NewManHandler creates a new man page handler

func (*ManHandler) CanHandle

func (h *ManHandler) CanHandle(query string) bool

func (*ManHandler) Handle

func (h *ManHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*ManHandler) Name

func (h *ManHandler) Name() string

func (*ManHandler) Patterns

func (h *ManHandler) Patterns() []*regexp.Regexp

type ManOption

type ManOption struct {
	Flag        string
	Description string
}

type ManPageInfo

type ManPageInfo struct {
	Command     string
	Section     string
	Name        string
	Synopsis    string
	Description string
	Options     []ManOption
	SeeAlso     []string
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager manages all instant answer handlers

func NewManager

func NewManager() *Manager

NewManager creates a new instant answer manager

func (*Manager) GetHandlers

func (m *Manager) GetHandlers() []Handler

GetHandlers returns all registered handlers

func (*Manager) Process

func (m *Manager) Process(ctx context.Context, query string) (*Answer, error)

Process checks if query matches any instant answer and returns the result

func (*Manager) Register

func (m *Manager) Register(h Handler)

Register adds a handler to the manager

type MathHandler

type MathHandler struct {
	// contains filtered or unexported fields
}

MathHandler handles mathematical expressions

func NewMathHandler

func NewMathHandler() *MathHandler

NewMathHandler creates a new math handler

func (*MathHandler) CanHandle

func (h *MathHandler) CanHandle(query string) bool

func (*MathHandler) Handle

func (h *MathHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*MathHandler) Name

func (h *MathHandler) Name() string

func (*MathHandler) Patterns

func (h *MathHandler) Patterns() []*regexp.Regexp

type NPMPackage

type NPMPackage struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	License     string `json:"license"`
	Homepage    string `json:"homepage"`
	DistTags    struct {
		Latest string `json:"latest"`
	} `json:"dist-tags"`
	Versions map[string]NPMVersionInfo `json:"versions"`
}

NPM response structures

type NPMVersionInfo

type NPMVersionInfo struct {
	Name        string   `json:"name"`
	Version     string   `json:"version"`
	Description string   `json:"description"`
	Keywords    []string `json:"keywords"`
	Repository  struct {
		Type string `json:"type"`
		URL  string `json:"url"`
	} `json:"repository"`
}

type NVDResponse

type NVDResponse struct {
	ResultsPerPage  int `json:"resultsPerPage"`
	StartIndex      int `json:"startIndex"`
	TotalResults    int `json:"totalResults"`
	Vulnerabilities []struct {
		CVE CVEItem `json:"cve"`
	} `json:"vulnerabilities"`
}

NVD API response structures

type ParsedRobots

type ParsedRobots struct {
	UserAgents []RobotUserAgent
	Sitemaps   []string
}

ParsedRobots represents parsed robots.txt content

type PasswordHandler

type PasswordHandler struct {
	// contains filtered or unexported fields
}

PasswordHandler generates secure passwords

func NewPasswordHandler

func NewPasswordHandler() *PasswordHandler

func (*PasswordHandler) CanHandle

func (h *PasswordHandler) CanHandle(query string) bool

func (*PasswordHandler) Handle

func (h *PasswordHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*PasswordHandler) Name

func (h *PasswordHandler) Name() string

func (*PasswordHandler) Patterns

func (h *PasswordHandler) Patterns() []*regexp.Regexp

type PkgHandler

type PkgHandler struct {
	// contains filtered or unexported fields
}

PkgHandler handles package information lookups from npm, PyPI, and pkg.go.dev

func NewPkgHandler

func NewPkgHandler() *PkgHandler

NewPkgHandler creates a new package handler

func (*PkgHandler) CanHandle

func (h *PkgHandler) CanHandle(query string) bool

func (*PkgHandler) Handle

func (h *PkgHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*PkgHandler) Name

func (h *PkgHandler) Name() string

func (*PkgHandler) Patterns

func (h *PkgHandler) Patterns() []*regexp.Regexp

type PortHandler

type PortHandler struct {
	// contains filtered or unexported fields
}

PortHandler looks up service information for port numbers

func NewPortHandler

func NewPortHandler() *PortHandler

NewPortHandler creates a new port handler

func (*PortHandler) CanHandle

func (h *PortHandler) CanHandle(query string) bool

func (*PortHandler) Handle

func (h *PortHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*PortHandler) Name

func (h *PortHandler) Name() string

func (*PortHandler) Patterns

func (h *PortHandler) Patterns() []*regexp.Regexp

type PyPIPackage

type PyPIPackage struct {
	Info struct {
		Name           string `json:"name"`
		Version        string `json:"version"`
		Summary        string `json:"summary"`
		Description    string `json:"description"`
		License        string `json:"license"`
		Author         string `json:"author"`
		AuthorEmail    string `json:"author_email"`
		HomePage       string `json:"home_page"`
		ProjectURL     string `json:"project_url"`
		RequiresPython string `json:"requires_python"`
		Keywords       string `json:"keywords"`
	} `json:"info"`
}

PyPI response structures

type QRHandler

type QRHandler struct {
	// contains filtered or unexported fields
}

QRHandler handles QR code generation

func NewQRHandler

func NewQRHandler() *QRHandler

NewQRHandler creates a new QR code handler

func (*QRHandler) CanHandle

func (h *QRHandler) CanHandle(query string) bool

func (*QRHandler) Handle

func (h *QRHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*QRHandler) Name

func (h *QRHandler) Name() string

func (*QRHandler) Patterns

func (h *QRHandler) Patterns() []*regexp.Regexp

type RFCHandler

type RFCHandler struct {
	// contains filtered or unexported fields
}

RFCHandler handles RFC (Request for Comments) document lookups

func NewRFCHandler

func NewRFCHandler() *RFCHandler

NewRFCHandler creates a new RFC handler

func (*RFCHandler) CanHandle

func (h *RFCHandler) CanHandle(query string) bool

func (*RFCHandler) Handle

func (h *RFCHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*RFCHandler) Name

func (h *RFCHandler) Name() string

func (*RFCHandler) Patterns

func (h *RFCHandler) Patterns() []*regexp.Regexp

type RFCInfo

type RFCInfo struct {
	Number    int
	Title     string
	Authors   []string
	Date      string
	Status    string
	Category  string
	Obsoletes []string
	Updates   []string
	Abstract  string
}

type RandomHandler

type RandomHandler struct {
	// contains filtered or unexported fields
}

RandomHandler generates random numbers

func NewRandomHandler

func NewRandomHandler() *RandomHandler

func (*RandomHandler) CanHandle

func (h *RandomHandler) CanHandle(query string) bool

func (*RandomHandler) Handle

func (h *RandomHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*RandomHandler) Name

func (h *RandomHandler) Name() string

func (*RandomHandler) Patterns

func (h *RandomHandler) Patterns() []*regexp.Regexp

type RedirectHop

type RedirectHop struct {
	URL        string `json:"url"`
	StatusCode int    `json:"status_code"`
	Status     string `json:"status"`
}

RedirectHop represents a single redirect in the chain

type RegexHandler

type RegexHandler struct {
	// contains filtered or unexported fields
}

RegexHandler handles regex pattern explanations and testing

func NewRegexHandler

func NewRegexHandler() *RegexHandler

NewRegexHandler creates a new regex handler

func (*RegexHandler) CanHandle

func (h *RegexHandler) CanHandle(query string) bool

func (*RegexHandler) Handle

func (h *RegexHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*RegexHandler) Name

func (h *RegexHandler) Name() string

func (*RegexHandler) Patterns

func (h *RegexHandler) Patterns() []*regexp.Regexp

type ResolveHandler

type ResolveHandler struct {
	// contains filtered or unexported fields
}

ResolveHandler handles DNS resolution queries

func NewResolveHandler

func NewResolveHandler() *ResolveHandler

NewResolveHandler creates a new DNS resolution handler

func (*ResolveHandler) CanHandle

func (h *ResolveHandler) CanHandle(query string) bool

func (*ResolveHandler) Handle

func (h *ResolveHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*ResolveHandler) Name

func (h *ResolveHandler) Name() string

func (*ResolveHandler) Patterns

func (h *ResolveHandler) Patterns() []*regexp.Regexp

type RobotDirective

type RobotDirective struct {
	Type  string `json:"type"`  // "allow", "disallow", "crawl-delay", "sitemap"
	Value string `json:"value"` // the path or value
}

RobotDirective represents a parsed robots.txt directive

type RobotUserAgent

type RobotUserAgent struct {
	Agent      string           `json:"agent"`
	Directives []RobotDirective `json:"directives"`
}

RobotUserAgent represents rules for a specific user agent

type RobotsHandler

type RobotsHandler struct {
	// contains filtered or unexported fields
}

RobotsHandler handles robots.txt fetching and parsing

func NewRobotsHandler

func NewRobotsHandler() *RobotsHandler

NewRobotsHandler creates a new robots.txt handler

func (*RobotsHandler) CanHandle

func (h *RobotsHandler) CanHandle(query string) bool

func (*RobotsHandler) Handle

func (h *RobotsHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*RobotsHandler) Name

func (h *RobotsHandler) Name() string

func (*RobotsHandler) Patterns

func (h *RobotsHandler) Patterns() []*regexp.Regexp

type SafeHandler

type SafeHandler struct {
	// contains filtered or unexported fields
}

SafeHandler performs basic URL safety checks

func NewSafeHandler

func NewSafeHandler() *SafeHandler

NewSafeHandler creates a new safety check handler

func (*SafeHandler) CanHandle

func (h *SafeHandler) CanHandle(query string) bool

func (*SafeHandler) Handle

func (h *SafeHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*SafeHandler) Name

func (h *SafeHandler) Name() string

func (*SafeHandler) Patterns

func (h *SafeHandler) Patterns() []*regexp.Regexp

type SafetyCheck

type SafetyCheck struct {
	Name    string `json:"name"`
	Status  string `json:"status"` // "pass", "warn", "fail", "info"
	Message string `json:"message"`
}

SafetyCheck represents a single safety check result

type SafetyResult

type SafetyResult struct {
	URL         string        `json:"url"`
	Safe        bool          `json:"safe"`
	Score       int           `json:"score"` // 0-100
	Checks      []SafetyCheck `json:"checks"`
	Certificate *CertInfo     `json:"certificate,omitempty"`
}

SafetyResult represents the overall safety assessment

type Sitemap

type Sitemap struct {
	XMLName  xml.Name       `xml:"urlset"`
	URLs     []SitemapURL   `xml:"url"`
	Sitemaps []SitemapIndex `xml:"sitemap"` // for sitemap index
}

Sitemap represents a parsed sitemap

type SitemapHandler

type SitemapHandler struct {
	// contains filtered or unexported fields
}

SitemapHandler parses and displays sitemap.xml contents

func NewSitemapHandler

func NewSitemapHandler() *SitemapHandler

NewSitemapHandler creates a new sitemap handler

func (*SitemapHandler) CanHandle

func (h *SitemapHandler) CanHandle(query string) bool

func (*SitemapHandler) Handle

func (h *SitemapHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*SitemapHandler) Name

func (h *SitemapHandler) Name() string

func (*SitemapHandler) Patterns

func (h *SitemapHandler) Patterns() []*regexp.Regexp

type SitemapIndex

type SitemapIndex struct {
	Loc     string `xml:"loc" json:"loc"`
	LastMod string `xml:"lastmod" json:"lastmod,omitempty"`
}

SitemapIndex represents a sitemap index entry

type SitemapIndexFile

type SitemapIndexFile struct {
	XMLName  xml.Name       `xml:"sitemapindex"`
	Sitemaps []SitemapIndex `xml:"sitemap"`
}

SitemapIndexFile represents a sitemap index file

type SitemapURL

type SitemapURL struct {
	Loc        string `xml:"loc" json:"loc"`
	LastMod    string `xml:"lastmod" json:"lastmod,omitempty"`
	ChangeFreq string `xml:"changefreq" json:"changefreq,omitempty"`
	Priority   string `xml:"priority" json:"priority,omitempty"`
}

SitemapURL represents a URL entry in a sitemap

type SlugHandler

type SlugHandler struct {
	// contains filtered or unexported fields
}

SlugHandler handles URL slug generation

func NewSlugHandler

func NewSlugHandler() *SlugHandler

NewSlugHandler creates a new slug handler

func (*SlugHandler) CanHandle

func (h *SlugHandler) CanHandle(query string) bool

func (*SlugHandler) Handle

func (h *SlugHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*SlugHandler) Name

func (h *SlugHandler) Name() string

func (*SlugHandler) Patterns

func (h *SlugHandler) Patterns() []*regexp.Regexp

type StopwatchHandler

type StopwatchHandler struct {
	// contains filtered or unexported fields
}

StopwatchHandler handles timer and stopwatch queries

func NewStopwatchHandler

func NewStopwatchHandler() *StopwatchHandler

NewStopwatchHandler creates a new stopwatch handler

func (*StopwatchHandler) CanHandle

func (h *StopwatchHandler) CanHandle(query string) bool

func (*StopwatchHandler) Handle

func (h *StopwatchHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*StopwatchHandler) Name

func (h *StopwatchHandler) Name() string

func (*StopwatchHandler) Patterns

func (h *StopwatchHandler) Patterns() []*regexp.Regexp

type SubnetHandler

type SubnetHandler struct {
	// contains filtered or unexported fields
}

SubnetHandler calculates CIDR subnet information

func NewSubnetHandler

func NewSubnetHandler() *SubnetHandler

NewSubnetHandler creates a new subnet handler

func (*SubnetHandler) CanHandle

func (h *SubnetHandler) CanHandle(query string) bool

func (*SubnetHandler) Handle

func (h *SubnetHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*SubnetHandler) Name

func (h *SubnetHandler) Name() string

func (*SubnetHandler) Patterns

func (h *SubnetHandler) Patterns() []*regexp.Regexp

type SynonymHandler

type SynonymHandler struct {
	// contains filtered or unexported fields
}

SynonymHandler handles synonym lookups

func NewSynonymHandler

func NewSynonymHandler() *SynonymHandler

NewSynonymHandler creates a new synonym handler

func (*SynonymHandler) CanHandle

func (h *SynonymHandler) CanHandle(query string) bool

func (*SynonymHandler) Handle

func (h *SynonymHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*SynonymHandler) Name

func (h *SynonymHandler) Name() string

func (*SynonymHandler) Patterns

func (h *SynonymHandler) Patterns() []*regexp.Regexp

type TLDRHandler

type TLDRHandler struct {
	// contains filtered or unexported fields
}

TLDRHandler fetches command summaries from tldr.sh

func NewTLDRHandler

func NewTLDRHandler() *TLDRHandler

NewTLDRHandler creates a new TLDR handler

func (*TLDRHandler) CanHandle

func (h *TLDRHandler) CanHandle(query string) bool

func (*TLDRHandler) Handle

func (h *TLDRHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*TLDRHandler) Name

func (h *TLDRHandler) Name() string

func (*TLDRHandler) Patterns

func (h *TLDRHandler) Patterns() []*regexp.Regexp

type TechHandler

type TechHandler struct {
	// contains filtered or unexported fields
}

TechHandler detects technology stack of a website

func NewTechHandler

func NewTechHandler() *TechHandler

NewTechHandler creates a new technology detection handler

func (*TechHandler) CanHandle

func (h *TechHandler) CanHandle(query string) bool

func (*TechHandler) Handle

func (h *TechHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*TechHandler) Name

func (h *TechHandler) Name() string

func (*TechHandler) Patterns

func (h *TechHandler) Patterns() []*regexp.Regexp

type TechInfo

type TechInfo struct {
	Name     string `json:"name"`
	Category string `json:"category"`
	Version  string `json:"version,omitempty"`
	Evidence string `json:"evidence,omitempty"`
}

TechInfo represents a detected technology

type TimeHandler

type TimeHandler struct {
	// contains filtered or unexported fields
}

TimeHandler handles time/date queries

func NewTimeHandler

func NewTimeHandler() *TimeHandler

func (*TimeHandler) CanHandle

func (h *TimeHandler) CanHandle(query string) bool

func (*TimeHandler) Handle

func (h *TimeHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*TimeHandler) Name

func (h *TimeHandler) Name() string

func (*TimeHandler) Patterns

func (h *TimeHandler) Patterns() []*regexp.Regexp

type TimestampHandler

type TimestampHandler struct {
	// contains filtered or unexported fields
}

TimestampHandler converts Unix timestamps

func NewTimestampHandler

func NewTimestampHandler() *TimestampHandler

NewTimestampHandler creates a new timestamp handler

func (*TimestampHandler) CanHandle

func (h *TimestampHandler) CanHandle(query string) bool

func (*TimestampHandler) Handle

func (h *TimestampHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*TimestampHandler) Name

func (h *TimestampHandler) Name() string

func (*TimestampHandler) Patterns

func (h *TimestampHandler) Patterns() []*regexp.Regexp

type TimezoneHandler

type TimezoneHandler struct {
	// contains filtered or unexported fields
}

TimezoneHandler handles timezone queries and conversions

func NewTimezoneHandler

func NewTimezoneHandler() *TimezoneHandler

NewTimezoneHandler creates a new timezone handler

func (*TimezoneHandler) CanHandle

func (h *TimezoneHandler) CanHandle(query string) bool

func (*TimezoneHandler) Handle

func (h *TimezoneHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*TimezoneHandler) Name

func (h *TimezoneHandler) Name() string

func (*TimezoneHandler) Patterns

func (h *TimezoneHandler) Patterns() []*regexp.Regexp

type URLHandler

type URLHandler struct {
	// contains filtered or unexported fields
}

URLHandler handles URL encoding/decoding and parsing

func NewURLHandler

func NewURLHandler() *URLHandler

func (*URLHandler) CanHandle

func (h *URLHandler) CanHandle(query string) bool

func (*URLHandler) Handle

func (h *URLHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*URLHandler) Name

func (h *URLHandler) Name() string

func (*URLHandler) Patterns

func (h *URLHandler) Patterns() []*regexp.Regexp

type UUIDHandler

type UUIDHandler struct {
	// contains filtered or unexported fields
}

UUIDHandler generates UUIDs

func NewUUIDHandler

func NewUUIDHandler() *UUIDHandler

func (*UUIDHandler) CanHandle

func (h *UUIDHandler) CanHandle(query string) bool

func (*UUIDHandler) Handle

func (h *UUIDHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*UUIDHandler) Name

func (h *UUIDHandler) Name() string

func (*UUIDHandler) Patterns

func (h *UUIDHandler) Patterns() []*regexp.Regexp

type UnicodeHandler

type UnicodeHandler struct {
	// contains filtered or unexported fields
}

UnicodeHandler handles unicode character lookups

func NewUnicodeHandler

func NewUnicodeHandler() *UnicodeHandler

NewUnicodeHandler creates a new unicode handler

func (*UnicodeHandler) CanHandle

func (h *UnicodeHandler) CanHandle(query string) bool

func (*UnicodeHandler) Handle

func (h *UnicodeHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*UnicodeHandler) Name

func (h *UnicodeHandler) Name() string

func (*UnicodeHandler) Patterns

func (h *UnicodeHandler) Patterns() []*regexp.Regexp

type WHOISHandler

type WHOISHandler struct {
	// contains filtered or unexported fields
}

WHOISHandler handles domain WHOIS lookups

func NewWHOISHandler

func NewWHOISHandler() *WHOISHandler

NewWHOISHandler creates a new WHOIS handler

func (*WHOISHandler) CanHandle

func (h *WHOISHandler) CanHandle(query string) bool

func (*WHOISHandler) Handle

func (h *WHOISHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*WHOISHandler) Name

func (h *WHOISHandler) Name() string

func (*WHOISHandler) Patterns

func (h *WHOISHandler) Patterns() []*regexp.Regexp

type YAMLHandler

type YAMLHandler struct {
	// contains filtered or unexported fields
}

YAMLHandler handles YAML formatting and conversion

func NewYAMLHandler

func NewYAMLHandler() *YAMLHandler

NewYAMLHandler creates a new YAML handler

func (*YAMLHandler) CanHandle

func (h *YAMLHandler) CanHandle(query string) bool

func (*YAMLHandler) Handle

func (h *YAMLHandler) Handle(ctx context.Context, query string) (*Answer, error)

func (*YAMLHandler) Name

func (h *YAMLHandler) Name() string

func (*YAMLHandler) Patterns

func (h *YAMLHandler) Patterns() []*regexp.Regexp

Jump to

Keyboard shortcuts

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