botwall

package
v0.140.2 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package botwall recognises the interstitial pages a bot-protection vendor answers a client it distrusts with: a captcha, a "checking your browser" wait, an "Access Denied" page.

A fetcher that stores or analyses whatever HTML came back keeps such a page as the site's content (2026-10-18, 100 real sites through the egress proxy: nytimes.com and reuters.com came back as one DataDome page of 1,486 bytes). Detect says which vendor's wall a document is, or that it is none, so the service can flag it, refuse it, or leave it alone.

The detector is deliberately conservative, because a false positive discards real content when a caller refuses walls:

  • only small documents (MaxBody: a challenge page is a few KB; a real page that merely embeds a vendor's script is not),
  • only documents with little visible text (MaxVisibleText non-space bytes outside tags, script and style),
  • and only vendor-specific markers, never a generic "captcha" or "access denied".

Not covered, by design: site-specific error pages (eBay's "Error Page"), walls that render something that looks like content, and any vendor not in Vendors.

It was written twice, identically, in go-js-proxy (0.12.0, 0.12.2) and the fleet fetch cache (0.3.48, 0.3.49); this package is the one copy, so a new vendor rule or a precision fix is made once.

Index

Constants

View Source
const (
	// MaxBody is the largest document, in bytes, that can be a challenge page.
	MaxBody = 160 << 10
	// MaxVisibleText is the most visible text (non-space bytes outside tags and
	// outside the bodies of script and style elements) a challenge page has.
	MaxVisibleText = 3000
)

Variables

This section is empty.

Functions

func Detect

func Detect(html string) string

Detect returns the vendor of a challenge page, or "" when the document is not one.

func Vendors

func Vendors() []string

Vendors are the values Detect can return. A service that counts walls per vendor lists all of them from the start so rate() and absent() alerts see every label. The slice is sorted; the caller gets a copy.

Types

This section is empty.

Jump to

Keyboard shortcuts

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