Documentation
¶
Overview ¶
Package hub implements EdgeFetch's self-hosted Go multi-node WebSocket controller (`--mode=hub` and hybrid mesh `--mode=hub,agent`), allowing one static Go binary to serve as both central fleet coordinator and fallback HTTP/2 + Chromium worker with zero external runtime dependencies beyond `coder/websocket`.
Capabilities ¶
- Accepts outbound Go worker connections on `GET /agent/ws` (authenticated via `EDGEFETCH_AGENT_TOKEN` or per-site `EDGEFETCH_AGENT_TOKENS`), streaming gzipped artifacts on `PUT /agent/artifacts/{sha}` and job completions on `POST /agent/reply`.
- Routes requests across connected nodes using sticky host affinity, Least-Recently-Used (`lastJobAt`) fairness, capability matching (`browser-v1`), and per-`(site, host)` `429` cooldown failover, falling back automatically to the local in-process `*crawl.Crawler` when no remote agents are available.
- Exposes `GET /health`, `GET /agents`, `GET /v1/capabilities`, `POST /fetch`, `POST /v1/scrape`, and a built-in Streamable HTTP Model Context Protocol server on `POST /mcp`.
- When paired with `--mode=hub,agent` and `EDGEFETCH_HUB_URLS`, enables active-active multi-controller and Tailscale/LAN standby mesh topologies.
Index ¶
- Variables
- func ExtractTavilyBodyAPIKey(rawBody []byte) string
- func IsRobotBypassedHost(rawURL string, bypassHosts []string) bool
- func ParseAgentTokensJSON(raw string) (map[string]string, error)
- func ReadBoundedBody(w http.ResponseWriter, r *http.Request, maxBytes int64) ([]byte, bool, error)
- func WithPrincipal(ctx context.Context, p AuthPrincipal) context.Context
- type AgentInfo
- type ArtifactSlicePage
- type ArtifactSliceRequest
- type AsyncJobRecord
- type AuthPrincipal
- type CollectionDocInput
- type CollectionSearchHit
- type Config
- type ConnectedMcpConfig
- type HostTelemetryEvent
- type MemoryRouteStore
- type RouteDeps
- type RouteHandler
- func (h *RouteHandler) ExecuteAgent(ctx context.Context, payload map[string]any, hdr http.Header, p AuthPrincipal, ...) (map[string]any, int)
- func (h *RouteHandler) ExecuteBatchScrape(ctx context.Context, payload map[string]any, hdr http.Header, ...) (map[string]any, int)
- func (h *RouteHandler) ExecuteCatalog(ctx context.Context, payload map[string]any, hdr http.Header, p AuthPrincipal) (map[string]any, int)
- func (h *RouteHandler) ExecuteCrawl(ctx context.Context, payload map[string]any, hdr http.Header, ...) (map[string]any, int)
- func (h *RouteHandler) ExecuteDiscoverMcpRegistry(ctx context.Context, query string, remoteOnly bool, limit int) (map[string]any, int)
- func (h *RouteHandler) ExecuteExtract(ctx context.Context, payload map[string]any, hdr http.Header, ownerID string) (map[string]any, int)
- func (h *RouteHandler) ExecuteFederatedMcpQuery(ctx context.Context, payload map[string]any, p AuthPrincipal) (map[string]any, int)
- func (h *RouteHandler) ExecuteInteract(ctx context.Context, payload map[string]any, hdr http.Header, ownerID string) (map[string]any, string, int)
- func (h *RouteHandler) ExecuteJobs(ctx context.Context, payload map[string]any, hdr http.Header, ownerID string) (map[string]any, int)
- func (h *RouteHandler) ExecuteMap(ctx context.Context, payload map[string]any, hdr http.Header) (map[string]any, string, int)
- func (h *RouteHandler) ExecuteScrape(ctx context.Context, req ScrapeRequest, hdr http.Header, ownerID string) (map[string]any, string, int)
- func (h *RouteHandler) ExecuteSearch(ctx context.Context, payload map[string]any, hdr http.Header, ownerID string) (map[string]any, int)
- func (h *RouteHandler) HandleAgent(w http.ResponseWriter, r *http.Request)
- func (h *RouteHandler) HandleAgentByID(w http.ResponseWriter, r *http.Request, id string)
- func (h *RouteHandler) HandleAgentTrace(w http.ResponseWriter, r *http.Request, id string)
- func (h *RouteHandler) HandleArtifactByID(w http.ResponseWriter, r *http.Request, artifactID string)
- func (h *RouteHandler) HandleBatchScrape(w http.ResponseWriter, r *http.Request)
- func (h *RouteHandler) HandleBatchScrapeByID(w http.ResponseWriter, r *http.Request, id string)
- func (h *RouteHandler) HandleCatalog(w http.ResponseWriter, r *http.Request)
- func (h *RouteHandler) HandleCatalogRecords(w http.ResponseWriter, r *http.Request, catalogID string)
- func (h *RouteHandler) HandleCatalogStatus(w http.ResponseWriter, r *http.Request, catalogID string)
- func (h *RouteHandler) HandleCollectionSearch(w http.ResponseWriter, r *http.Request, collectionID string)
- func (h *RouteHandler) HandleCompat(w http.ResponseWriter, r *http.Request) bool
- func (h *RouteHandler) HandleCrawl(w http.ResponseWriter, r *http.Request)
- func (h *RouteHandler) HandleCrawlByID(w http.ResponseWriter, r *http.Request, id string)
- func (h *RouteHandler) HandleCrawlParamsPreview(w http.ResponseWriter, r *http.Request)
- func (h *RouteHandler) HandleExtract(w http.ResponseWriter, r *http.Request)
- func (h *RouteHandler) HandleHosts(w http.ResponseWriter, r *http.Request, gaps bool)
- func (h *RouteHandler) HandleIngestTab(w http.ResponseWriter, r *http.Request)
- func (h *RouteHandler) HandleInteract(w http.ResponseWriter, r *http.Request)
- func (h *RouteHandler) HandleJobs(w http.ResponseWriter, r *http.Request)
- func (h *RouteHandler) HandleMCP(w http.ResponseWriter, r *http.Request)
- func (h *RouteHandler) HandleMCPQuery(w http.ResponseWriter, r *http.Request)
- func (h *RouteHandler) HandleMCPRegistry(w http.ResponseWriter, r *http.Request)
- func (h *RouteHandler) HandleMap(w http.ResponseWriter, r *http.Request)
- func (h *RouteHandler) HandleScrape(w http.ResponseWriter, r *http.Request)
- func (h *RouteHandler) HandleSearch(w http.ResponseWriter, r *http.Request)
- func (h *RouteHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (h *RouteHandler) TryServeRoute(w http.ResponseWriter, r *http.Request) bool
- type ScrapeCacheEntry
- type ScrapeCacheLookup
- type ScrapeRequest
- type Server
- func (s *Server) Close() error
- func (s *Server) DispatchOrFallback(ctx context.Context, call crawl.FetchCall, target, preferredSite string, ...) (reply crawl.FetchReply, via string, status int, err error)
- func (s *Server) ListAgents() map[string]any
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type WebSearchHit
- type WebSearchRequest
- type WebSearchResponse
Constants ¶
This section is empty.
Variables ¶
var CanonicalMCPToolNames = []string{
"list_agents",
"fetch_url",
"fetch_batch",
"scrape",
"extract",
"map",
"crawl",
"search",
"search_collection",
"interact",
"read_artifact",
"jobs",
"find_extractors",
"catalog",
"agent",
"discover_mcp_servers",
"call_connected_mcp",
}
CanonicalMCPToolNames lists all 17 MCP tools exposed by EdgeFetch Go Hub.
Functions ¶
func ExtractTavilyBodyAPIKey ¶ added in v2.8.17
ExtractTavilyBodyAPIKey inspects a raw JSON request body for Tavily's `"api_key"` field so `ServeHTTP` authentication middleware can validate Tavily SDK callers without `Authorization` headers.
func IsRobotBypassedHost ¶ added in v2.8.17
IsRobotBypassedHost reports whether `rawURL`'s host matches `bypassHosts` (exact or subdomain).
func ParseAgentTokensJSON ¶
ParseAgentTokensJSON parses `EDGEFETCH_AGENT_TOKENS` (`{"site-1":"<token>"}`) and enforces >= 24-char secrets.
func ReadBoundedBody ¶ added in v2.8.17
ReadBoundedBody reads at most `maxBytes` from `r.Body`, returning `(nil, true, nil)` when the payload exceeds `maxBytes`.
func WithPrincipal ¶ added in v2.8.17
func WithPrincipal(ctx context.Context, p AuthPrincipal) context.Context
WithPrincipal attaches `p` onto `ctx`.
Types ¶
type AgentInfo ¶
type AgentInfo struct {
SiteID string `json:"siteId"`
Arch string `json:"arch"`
Version string `json:"version,omitempty"`
Capabilities []string `json:"capabilities"`
Busy bool `json:"busy"`
ConnectedAt int64 `json:"connectedAt"`
LastJobAt int64 `json:"lastJobAt,omitempty"`
JobsOK int64 `json:"jobsOk"`
JobsErr int64 `json:"jobsErr"`
}
AgentInfo summarizes a connected worker node in `GET /agents` and MCP `list_agents`.
type ArtifactSlicePage ¶ added in v2.8.17
type ArtifactSlicePage struct {
ArtifactID string `json:"artifactId"`
Content string `json:"content"`
Format string `json:"format"`
TotalChars int `json:"totalChars"`
ReturnedChars int `json:"returnedChars"`
Offset int `json:"offset"`
Truncated bool `json:"truncated"`
NextOffset *int `json:"nextOffset,omitempty"`
}
type ArtifactSliceRequest ¶ added in v2.8.17
type ArtifactSliceRequest struct {
ArtifactID string `json:"artifactId"`
OwnerID string `json:"ownerId,omitempty"`
Visibility string `json:"visibility,omitempty"`
Retention string `json:"retention,omitempty"`
Format string `json:"format,omitempty"`
Offset int `json:"offset"`
Limit int `json:"limit"`
}
type AsyncJobRecord ¶ added in v2.8.17
type AsyncJobRecord struct {
Kind string `json:"kind"`
ID string `json:"id"`
OwnerID string `json:"ownerId"`
Status string `json:"status"`
Total int `json:"total"`
Completed int `json:"completed"`
CollectionID string `json:"collectionId,omitempty"`
Data []map[string]any `json:"data,omitempty"`
Errors []map[string]any `json:"errors,omitempty"`
Payload map[string]any `json:"payload,omitempty"`
CreatedAtMs int64 `json:"createdAtMs"`
UpdatedAtMs int64 `json:"updatedAtMs"`
}
type AuthPrincipal ¶ added in v2.8.17
type AuthPrincipal struct {
Authenticated bool
Kind string // "owner", "mcp_token", "oauth", "github", "admin_cookie", "loopback"
UserID string
GitHubLogin string
Role string // "owner", "member", ""
Scopes []string
GrantID string
ClientID string
IsOwner bool
}
AuthPrincipal identifies the authenticated caller across `/v1/*`, `/mcp`, `/oauth/*`, and `/admin/*`.
func PrincipalFromContext ¶ added in v2.8.17
func PrincipalFromContext(ctx context.Context) AuthPrincipal
PrincipalFromContext returns the `AuthPrincipal` stored on `ctx` (zero value when unauthenticated).
func (AuthPrincipal) EffectiveOwnerID ¶ added in v2.8.17
func (p AuthPrincipal) EffectiveOwnerID() string
EffectiveOwnerID returns the tenant namespace key (`"owner"` for single-tenant owner/loopback callers, or `UserID`).
func (AuthPrincipal) HasScope ¶ added in v2.8.17
func (p AuthPrincipal) HasScope(want string) bool
HasScope reports whether the principal holds `want` (owners hold all scopes).
type CollectionDocInput ¶ added in v2.8.17
type CollectionDocInput struct {
CollectionID string `json:"collectionId"`
OwnerID string `json:"ownerId"`
Visibility string `json:"visibility"`
DocumentID string `json:"documentId"`
PageID string `json:"pageId"`
URL string `json:"url"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
Markdown string `json:"markdown"`
FetchedAtMs int64 `json:"fetchedAtMs"`
}
type CollectionSearchHit ¶ added in v2.8.17
type Config ¶
type Config struct {
CallerToken string
McpToken string
AgentToken string
AgentTokens map[string]string
PeerURLs []string
PeerToken string
PeerHTTPClient *http.Client
OperatorClient *http.Client
FallbackCrawler *crawl.Crawler
BotSigner *botauth.Signer
BotPublicJWKs []botauth.PublicJWK
BotContactURL string
UserAgent string
AllowedLoopbackPort string
MaxConcurrentCalls int
Allow func(*url.URL) error
Logger *slog.Logger
DispatchTimeout time.Duration
MaxArtifactMemory int
OtelExporter *otel.Exporter
DataDir string
SessionSecret string
VaultMasterKey string
PublicOrigin string
TrustProxy bool
TrustFly bool
DisableUpdateCheck bool
RobotsBypassHosts []string
RedirectAllowlist []string
GitHub hubauth.GitHubConfig
Getenv func(string) string
}
Config configures a self-hosted Go Hub controller instance.
type ConnectedMcpConfig ¶ added in v2.8.17
type ConnectedMcpConfig struct {
ID string `json:"id"`
Name string `json:"name"`
EndpointURL string `json:"endpointUrl"`
Transport string `json:"transport"`
AuthType string `json:"authType"`
Enabled bool `json:"enabled"`
DomainPatterns []string `json:"domainPatterns,omitempty"`
Description string `json:"description,omitempty"`
ToolsCache []map[string]any `json:"toolsCache,omitempty"`
SealedAuth string `json:"sealedAuth,omitempty"`
PlainHeaders map[string]string `json:"plainHeaders,omitempty"`
UpdatedAtMs int64 `json:"updatedAtMs,omitempty"`
}
type HostTelemetryEvent ¶ added in v2.8.17
type MemoryRouteStore ¶ added in v2.8.17
type MemoryRouteStore struct {
// contains filtered or unexported fields
}
func NewMemoryRouteStore ¶ added in v2.8.17
func NewMemoryRouteStore() *MemoryRouteStore
type RouteDeps ¶ added in v2.8.17
type RouteDeps struct {
DispatchFetch func(ctx context.Context, call crawl.FetchCall, target, site string, hdr http.Header) (reply crawl.FetchReply, via string, status int, err error)
HasBrowserCapability func() bool
AllowURL func(*url.URL) error
OperatorClient *http.Client
OtelExporter *otel.Exporter
Getenv func(string) string
RobotsBypassHosts []string
SessionSecret string
PublicOrigin string
VaultMasterKey string
ListAgents func() map[string]any
Capabilities func() map[string]any
LookupScrapeCache func(ctx context.Context, rawURL, ownerID string, maxAgeMs int64, ifNoneMatch string) (ScrapeCacheLookup, error)
StoreScrapeCache func(ctx context.Context, entry ScrapeCacheEntry) error
PersistMarkdownArtifact func(ctx context.Context, markdown, ownerID, visibility string) (artifactID string, err error)
ReadArtifactPage func(ctx context.Context, req ArtifactSliceRequest) (*ArtifactSlicePage, int, string, error)
RecordHostTelemetry func(ctx context.Context, ev HostTelemetryEvent)
ListHosts func(ctx context.Context, limit int) ([]map[string]any, error)
ListHostGaps func(ctx context.Context, limit int) ([]map[string]any, error)
PutAsyncJob func(ctx context.Context, rec AsyncJobRecord) error
GetAsyncJob func(ctx context.Context, kind, id, ownerID string) (*AsyncJobRecord, bool)
CancelAsyncJob func(ctx context.Context, kind, id, ownerID string) bool
IngestCollectionPage func(ctx context.Context, doc CollectionDocInput) (indexedChunks int, err error)
SearchCollection func(ctx context.Context, collectionID, query, ownerID string, limit int) ([]CollectionSearchHit, error)
ExecuteWebSearch func(ctx context.Context, req WebSearchRequest) (*WebSearchResponse, error)
CatalogStore *catalog.CatalogStore
ListConnectedMcp func(ctx context.Context, ownerID string) ([]ConnectedMcpConfig, error)
}
RouteDeps decouples `/v1/*`, `/v2/*`, `/compat/*`, and `/mcp` handlers from storage/auth concrete types.
func NewServerRouteDeps ¶ added in v2.8.17
type RouteHandler ¶ added in v2.8.17
type RouteHandler struct {
// contains filtered or unexported fields
}
func NewRouteHandler ¶ added in v2.8.17
func NewRouteHandler(deps RouteDeps) *RouteHandler
func (*RouteHandler) ExecuteAgent ¶ added in v2.8.17
func (h *RouteHandler) ExecuteAgent( ctx context.Context, payload map[string]any, hdr http.Header, p AuthPrincipal, onSSE func(string, map[string]any), ) (map[string]any, int)
ExecuteAgent resolves BYO-LLM configuration, executes `agentloop.RunAgentLoop` with OTLP `edgefetch.llm.turn` spans, and persists state.
func (*RouteHandler) ExecuteBatchScrape ¶ added in v2.8.17
func (*RouteHandler) ExecuteCatalog ¶ added in v2.8.17
func (h *RouteHandler) ExecuteCatalog(ctx context.Context, payload map[string]any, hdr http.Header, p AuthPrincipal) (map[string]any, int)
ExecuteCatalog runs Shopify / WooCommerce storefront catalog extraction, snapshot hashing, and diffing.
func (*RouteHandler) ExecuteCrawl ¶ added in v2.8.17
func (*RouteHandler) ExecuteDiscoverMcpRegistry ¶ added in v2.8.17
func (*RouteHandler) ExecuteExtract ¶ added in v2.8.17
func (h *RouteHandler) ExecuteExtract(ctx context.Context, payload map[string]any, hdr http.Header, ownerID string) (map[string]any, int)
ExecuteExtract scrapes 1..10 URLs and runs BYO-LLM or deterministic structured extraction.
func (*RouteHandler) ExecuteFederatedMcpQuery ¶ added in v2.8.17
func (h *RouteHandler) ExecuteFederatedMcpQuery(ctx context.Context, payload map[string]any, p AuthPrincipal) (map[string]any, int)
func (*RouteHandler) ExecuteInteract ¶ added in v2.8.17
func (h *RouteHandler) ExecuteInteract(ctx context.Context, payload map[string]any, hdr http.Header, ownerID string) (map[string]any, string, int)
ExecuteInteract validates browser availability (`T2-A4`), HMAC-binds `sessionId`, and runs interactive browser actions.
func (*RouteHandler) ExecuteJobs ¶ added in v2.8.17
func (h *RouteHandler) ExecuteJobs(ctx context.Context, payload map[string]any, hdr http.Header, ownerID string) (map[string]any, int)
ExecuteJobs discovers ATS boards/feeds, parses Greenhouse/Lever/Ashby/JSON-LD postings, and filters/ranks results.
func (*RouteHandler) ExecuteMap ¶ added in v2.8.17
func (h *RouteHandler) ExecuteMap(ctx context.Context, payload map[string]any, hdr http.Header) (map[string]any, string, int)
ExecuteMap discovers URLs from `/llms.txt`, `/sitemap.xml`, and page links.
func (*RouteHandler) ExecuteScrape ¶ added in v2.8.17
func (h *RouteHandler) ExecuteScrape(ctx context.Context, req ScrapeRequest, hdr http.Header, ownerID string) (map[string]any, string, int)
ExecuteScrape performs a single-URL scrape with cache, twin pre-fetch, raw HTML extraction, Content-Signal/x402 gates, SPA fallback, and artifact slicing.
func (*RouteHandler) ExecuteSearch ¶ added in v2.8.17
func (*RouteHandler) HandleAgent ¶ added in v2.8.17
func (h *RouteHandler) HandleAgent(w http.ResponseWriter, r *http.Request)
HandleAgent serves `POST /v1/agent` (JSON or `text/event-stream` SSE).
func (*RouteHandler) HandleAgentByID ¶ added in v2.8.17
func (h *RouteHandler) HandleAgentByID(w http.ResponseWriter, r *http.Request, id string)
func (*RouteHandler) HandleAgentTrace ¶ added in v2.8.17
func (h *RouteHandler) HandleAgentTrace(w http.ResponseWriter, r *http.Request, id string)
func (*RouteHandler) HandleArtifactByID ¶ added in v2.8.17
func (h *RouteHandler) HandleArtifactByID(w http.ResponseWriter, r *http.Request, artifactID string)
HandleArtifactByID serves `GET /v1/artifacts/:id` with checkpoint-safe slice paging and tenant isolation.
func (*RouteHandler) HandleBatchScrape ¶ added in v2.8.17
func (h *RouteHandler) HandleBatchScrape(w http.ResponseWriter, r *http.Request)
HandleBatchScrape serves `POST /v1/batch/scrape`.
func (*RouteHandler) HandleBatchScrapeByID ¶ added in v2.8.17
func (h *RouteHandler) HandleBatchScrapeByID(w http.ResponseWriter, r *http.Request, id string)
func (*RouteHandler) HandleCatalog ¶ added in v2.8.17
func (h *RouteHandler) HandleCatalog(w http.ResponseWriter, r *http.Request)
HandleCatalog serves `POST /v1/catalog`.
func (*RouteHandler) HandleCatalogRecords ¶ added in v2.8.17
func (h *RouteHandler) HandleCatalogRecords(w http.ResponseWriter, r *http.Request, catalogID string)
HandleCatalogRecords serves `GET /v1/catalog/:id/records`.
func (*RouteHandler) HandleCatalogStatus ¶ added in v2.8.17
func (h *RouteHandler) HandleCatalogStatus(w http.ResponseWriter, r *http.Request, catalogID string)
HandleCatalogStatus serves `GET /v1/catalog/:id`.
func (*RouteHandler) HandleCollectionSearch ¶ added in v2.8.17
func (h *RouteHandler) HandleCollectionSearch(w http.ResponseWriter, r *http.Request, collectionID string)
HandleCollectionSearch serves `GET / POST /v1/collections/:id/search`.
func (*RouteHandler) HandleCompat ¶ added in v2.8.17
func (h *RouteHandler) HandleCompat(w http.ResponseWriter, r *http.Request) bool
HandleCompat routes Firecrawl v2 (`/v2/*`, `/compat/firecrawl/v2/*`) and Tavily (`/compat/tavily/*`) requests.
func (*RouteHandler) HandleCrawl ¶ added in v2.8.17
func (h *RouteHandler) HandleCrawl(w http.ResponseWriter, r *http.Request)
func (*RouteHandler) HandleCrawlByID ¶ added in v2.8.17
func (h *RouteHandler) HandleCrawlByID(w http.ResponseWriter, r *http.Request, id string)
func (*RouteHandler) HandleCrawlParamsPreview ¶ added in v2.8.17
func (h *RouteHandler) HandleCrawlParamsPreview(w http.ResponseWriter, r *http.Request)
func (*RouteHandler) HandleExtract ¶ added in v2.8.17
func (h *RouteHandler) HandleExtract(w http.ResponseWriter, r *http.Request)
HandleExtract serves `POST /v1/extract`.
func (*RouteHandler) HandleHosts ¶ added in v2.8.17
func (h *RouteHandler) HandleHosts(w http.ResponseWriter, r *http.Request, gaps bool)
func (*RouteHandler) HandleIngestTab ¶ added in v2.8.17
func (h *RouteHandler) HandleIngestTab(w http.ResponseWriter, r *http.Request)
HandleIngestTab serves `OPTIONS / POST /v1/ingest-tab` (`T2-A6`).
func (*RouteHandler) HandleInteract ¶ added in v2.8.17
func (h *RouteHandler) HandleInteract(w http.ResponseWriter, r *http.Request)
HandleInteract serves `POST /v1/interact`.
func (*RouteHandler) HandleJobs ¶ added in v2.8.17
func (h *RouteHandler) HandleJobs(w http.ResponseWriter, r *http.Request)
HandleJobs serves `POST /v1/jobs`.
func (*RouteHandler) HandleMCP ¶ added in v2.8.17
func (h *RouteHandler) HandleMCP(w http.ResponseWriter, r *http.Request)
HandleMCP serves Streamable HTTP MCP (`2026-07-28` & `2025-03-26`) over `POST /mcp`.
func (*RouteHandler) HandleMCPQuery ¶ added in v2.8.17
func (h *RouteHandler) HandleMCPQuery(w http.ResponseWriter, r *http.Request)
func (*RouteHandler) HandleMCPRegistry ¶ added in v2.8.17
func (h *RouteHandler) HandleMCPRegistry(w http.ResponseWriter, r *http.Request)
func (*RouteHandler) HandleMap ¶ added in v2.8.17
func (h *RouteHandler) HandleMap(w http.ResponseWriter, r *http.Request)
HandleMap serves `POST /v1/map`.
func (*RouteHandler) HandleScrape ¶ added in v2.8.17
func (h *RouteHandler) HandleScrape(w http.ResponseWriter, r *http.Request)
HandleScrape serves `POST /v1/scrape`.
func (*RouteHandler) HandleSearch ¶ added in v2.8.17
func (h *RouteHandler) HandleSearch(w http.ResponseWriter, r *http.Request)
func (*RouteHandler) ServeHTTP ¶ added in v2.8.17
func (h *RouteHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*RouteHandler) TryServeRoute ¶ added in v2.8.17
func (h *RouteHandler) TryServeRoute(w http.ResponseWriter, r *http.Request) bool
type ScrapeCacheEntry ¶ added in v2.8.17
type ScrapeCacheLookup ¶ added in v2.8.17
type ScrapeRequest ¶ added in v2.8.17
type ScrapeRequest struct {
URL string `json:"url"`
Formats []any `json:"formats,omitempty"`
OnlyMainContent *bool `json:"onlyMainContent,omitempty"`
RenderMode string `json:"renderMode,omitempty"`
WaitFor int `json:"waitFor,omitempty"`
WaitForMs int `json:"waitForMs,omitempty"`
Mobile bool `json:"mobile,omitempty"`
Actions []browser.InteractAction `json:"actions,omitempty"`
Query string `json:"query,omitempty"`
MaxChars int `json:"maxChars,omitempty"`
MaxAge int64 `json:"maxAge,omitempty"`
MaxAgeMs *int64 `json:"maxAgeMs,omitempty"`
SpaFallback any `json:"spaFallback,omitempty"`
Target string `json:"target,omitempty"`
Site string `json:"site,omitempty"`
Visibility string `json:"visibility,omitempty"`
// contains filtered or unexported fields
}
ScrapeRequest models `POST /v1/scrape` parameters.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server coordinates connected Go edge workers and serves `/fetch`, `/v1/*`, `/v2/*`, `/oauth/*`, `/admin`, and `/mcp`.
func (*Server) Close ¶
Close disconnects any active agent WebSockets cleanly during server shutdown.
func (*Server) DispatchOrFallback ¶
func (s *Server) DispatchOrFallback( ctx context.Context, call crawl.FetchCall, target, preferredSite string, traceHdr http.Header, ) (reply crawl.FetchReply, via string, status int, err error)
DispatchOrFallback routes `call` to a connected WebSocket agent (failing over on 429/disconnect), or falls back to the Hub's in-process `FallbackCrawler` when `target` is `"auto"` or `"container"`.
func (*Server) ListAgents ¶
ListAgents returns fleet status across all currently connected WebSocket workers.
type WebSearchHit ¶ added in v2.8.17
type WebSearchRequest ¶ added in v2.8.17
type WebSearchRequest struct {
Query string `json:"query"`
Limit int `json:"limit"`
Collection string `json:"collection,omitempty"`
Sources []string `json:"sources,omitempty"`
Scrape bool `json:"scrape,omitempty"`
MaxChars int `json:"maxChars,omitempty"`
OwnerID string `json:"ownerId,omitempty"`
Visibility string `json:"visibility,omitempty"`
}
type WebSearchResponse ¶ added in v2.8.17
type WebSearchResponse struct {
Provider string `json:"provider"`
Query string `json:"query"`
Results []WebSearchHit `json:"results"`
}
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package hubauth implements authentication, authorization, OAuth 2.1 + PKCE (S256), multi-user GitHub OAuth, the /admin Control Center & AES-256-GCM MCP credential vault, and connection/origin/header hardening for the Go Hub.
|
Package hubauth implements authentication, authorization, OAuth 2.1 + PKCE (S256), multi-user GitHub OAuth, the /admin Control Center & AES-256-GCM MCP credential vault, and connection/origin/header hardening for the Go Hub. |
|
Package hubstore implements the pure-Go storage, search, and tracker-list subsystem for the self-contained EdgeFetch Hub (`edgefetch --hub`).
|
Package hubstore implements the pure-Go storage, search, and tracker-list subsystem for the self-contained EdgeFetch Hub (`edgefetch --hub`). |