Overview
Inspired by network tarpit techniques, this responder:- Sends HTTP headers immediately (appears responsive)
- Streams content at a configurable slow rate (default: 24 bytes/second)
- Holds connections open for an extended period
- Wastes bandwidth, time, and resources of scrapers
- Can serve content from files, HTTP sources, or just hold the connection
Configuration
The Tarpit responder requires atarpit_config block with its settings.
Required Parameters
IP ranges to tarpit. Can be CIDR notations or predefined service keys.Default:
["aws", "azurepubliccloud", "deepseek", "gcloud", "githubcopilot", "openai"]Tarpit Configuration Block
Maximum duration to keep the connection open.Must be greater than 0.Examples:
30s, 5m, 1hRate at which to stream data (bytes per second).Must be greater than 10.Default:
24 (extremely slow)Recommendations:24- Maximum annoyance (1 minute for 1.4KB)100- Still slow but less extreme1000- Moderate slowdown
HTTP status code to return.Default:
200Custom HTTP headers to include in the response.Default:
{}Content source in the format
protocol://pathSupported protocols:file://- Serve content from local filehttp://- Fetch and cache content from HTTP URLhttps://- Fetch and cache content from HTTPS URL- Empty - Just hold connection without sending content
Content Sources
File Content
HTTP/HTTPS Content
No Content (Timeout Only)
Examples
Implementation Details
The Tarpit responder is implemented inresponders/tarpit/tarpit.go:82:
Streaming Algorithm
- Open content stream from configured source
- Read first 512 bytes to detect content type
- Send HTTP headers immediately (appears responsive)
- Write first chunk to client
- Start ticker that fires every 100ms
- Each tick: Send
bytes_per_second / 10bytes - Continue until timeout or EOF reached
- Close connection gracefully
Content Type Detection
Content type is automatically detected from the first 512 bytes usinghttp.DetectContentType().
HTTP Response
Configured response code (default: 200)
Auto-detected from content or set via headers
Streamed at configured bytes_per_second rate
Any headers configured in tarpit_config.headers
Client Experience
What Scrapers See
Resource Impact on Scrapers
- Connection slots - Ties up connection pool
- Memory - Buffers accumulate slowly
- Time - Wastes significant wall-clock time
- Bandwidth - Over extended period, still uses bandwidth
- Processing - May trigger timeouts and retries
Use Cases
Maximum Scraper Annoyance
Make scraping as painful as possible:AI Training Poisoning
Serve garbage slowly to waste maximum resources:Connection Exhaustion
Tie up scraper connection pools:Advantages
- Resource Waste - Maximizes scraper resource consumption
- Appears Valid - Returns 200 OK, scrapers think it’s working
- Connection Exhaustion - Ties up connection pools
- Time Waste - Scrapers spend ages getting minimal data
- Configurable - Fine-tune annoyance level
- No Blocking Signal - Scrapers can’t easily detect they’re being tarpitted
Disadvantages
- Server Resources - Keeps connections open longer
- Memory Usage - Each connection consumes server resources
- Complexity - More complex than simple blocking
- Bandwidth Over Time - Eventually sends the data (if content provided)
Comparison with Other Responders
- vs Block: Tarpit wastes resources, Block denies immediately
- vs Drop: Tarpit holds connection, Drop terminates it
- vs Garbage: Tarpit sends slowly, Garbage sends quickly
- vs Custom: Tarpit streams, Custom sends full response
When to Use Tarpit
Use Tarpit when:- You want to waste maximum scraper resources
- Connection exhaustion is a goal
- Time-wasting is more valuable than bandwidth savings
- You want scrapers to think they’re succeeding (slowly)
- Server connection limits are tight
- You need to minimize resource usage
- Simple blocking is sufficient
- Legitimate users might be affected
Performance Considerations
Connection Limits
Each tarpitted connection stays open for the timeout duration. Monitor server connection limits:Memory Usage
Each connection uses memory for:- HTTP buffers
- Content reader
- Ticker
- Response writer
Best Practices
- Set reasonable timeouts - Don’t exhaust server resources (e.g., 30s-5m)
- Monitor connection counts - Watch for resource exhaustion
- Use small bytes_per_second - 10-50 for maximum annoyance
- Serve garbage content - Combine with useless data
- Target specific ranges - Don’t tarpit legitimate users
- Test thoroughly - Ensure you’re not tarpitting yourself
Validation Errors
The tarpit config is validated:tarpit timeout must be greater than 0tarpit bytes_per_second must be greater than 10unsupported tarpit Content protocol
Testing
Test tarpit behavior:Advanced Examples
Different Speeds for Different Sources
Serve Realistic-Looking Content Slowly
Related Documentation
- Garbage Responder - Fast garbage delivery
- Drop Responder - Drop connections instead
- Block Responder - Simple blocking
- Network Tarpits - Background on tarpit technique