Skip to main content

Module utils

Module utils 

Source
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§

SerializableRegex
A wrapper type for fancy_regex::Regex that 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