Skip to main content
The proxy package provides utilities for loading proxies from files, parsing user agent lists, and filtering proxies by attack method.

Package Overview

This package handles:
  • Loading proxies from text files with various formats
  • Parsing authentication credentials
  • Loading user agent lists
  • Filtering proxies by protocol compatibility

Functions

LoadProxies

Loads and parses proxies from a text file. Supports multiple formats and protocols. Parameters: Returns:
[]engine.Proxy
Parsed proxy list
error
Error if file cannot be read or parsed
Supported Formats:
Parsing Rules:
  • Default protocol: http
  • Explicit protocol: http://, https://, socks4://, socks5://
  • Protocol prefix is removed from the host string
  • Regex pattern: ^([^:]+):([^@]+)@(.+)$
  • Format: username:password@host:port
  • Username and password stored in Proxy.Username and Proxy.Password
  • Credentials removed from host string after extraction
  • Default port: 8080
  • Custom port: parsed from host:port format
  • Invalid port numbers fall back to 8080
  • Lines starting with # are ignored
  • Empty lines and whitespace-only lines are skipped
  • Leading/trailing whitespace is trimmed from all lines
Example:
Output:

LoadUserAgents

Loads user agent strings from a text file (one per line). Parameters: Returns:
[]string
List of user agent strings
error
Error if file cannot be read
File Format:
user-agents.txt
Processing:
  • Splits file by newlines
  • Trims whitespace from each line
  • Skips empty lines
  • Skips lines starting with # (comments)
Example:

FilterByMethod

Filters proxies to only those compatible with the given attack method. Parameters: Returns:
[]engine.Proxy
Proxies compatible with the specified method
Compatibility Matrix:
Why SOCKS-only for some attacks?HTTP/HTTPS proxies work at the application layer and can only forward HTTP requests. Attacks like Slowloris, TCP flood, and Minecraft ping require raw TCP connections, which only SOCKS proxies support.
Example:
Output:

Complete Usage Example

Proxy File Best Practices

Use comments to organize proxies by protocol, region, or purpose:
Regularly validate proxies before use:
Maintain separate files for different attack requirements:
Store authenticated proxies in separate, secured files:
premium-proxies.txt
Ensure proper file permissions:

Error Handling

File Not Found

Empty Proxy List

Malformed Lines

See Also