Expand description
§Utility Module
This module provides common utility functions used throughout the gooty proxy system. It includes validation functions, string manipulation, and other helpers.
§Components
- URL utilities - Functions for validating and working with URLs
- Regex utilities - Functions for validating and working with regular expressions
- Random generators - Functions for generating random values
§Examples
use gooty_proxy::utils;
let url = "https://example.com";
assert!(utils::is_valid_url(url));
let regex_pattern = r"(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}):\d+";
assert!(utils::validate_regex(regex_pattern).is_ok());Structs§
- Serializable
Regex - A wrapper type for
fancy_regex::Regexthat implements Serialize, Deserialize,PartialEq, Eq
Functions§
- get_
random_ user_ agent - Returns a random User-Agent string from the default list
- is_
valid_ ip - Checks if a string is a valid IPv4 or IPv6 address
- is_
valid_ port - Checks if a number is a valid port number (1-65535)
- is_
valid_ url - Validates whether a given string is a valid URL
- sanitize_
url_ for_ filename - Sanitizes a URL to be used as part of a filename
- validate_
regex - Validates and compiles a regex pattern