1. Overview
Proxy discovery utility that parses HTTP, HTTPS, and SOCKS proxy settings from environment variables and configuration files, normalizes endpoint data, removes duplicates, and tests whether a destination matches a configured proxy.
File role: Header Interface. The file contains 43 lines and belongs to the util/ProxyDetect.hpp path.
The companion file is util/ProxyDetect.cpp.
2. Component Responsibilities
- Declare the component API, owned state, callbacks, and data structures.
- Read standard lower- and uppercase proxy environment variables
- Parse proxy URLs into scheme, host, and port
- Inspect supported environment/configuration files
- Normalize and deduplicate endpoints
- Cache the detected list once per process
- Compare connection destinations against known proxy endpoints
3. Dependencies and Integration
System and library dependencies:
cstdintstringvector
4. Declared Types
ProxyEndpoint
Declares a struct.
5. Owned State and UI Members
Data and configuration state
std::string host;std::uint16_t port{0};std::string scheme;
6. Functions and Methods
The file exposes or implements 2 detected function or method signatures.
1. detected_proxies
const std::vector<ProxyEndpoint>& detected_proxies()
Detects detected proxies from available system or configuration sources.
2. matches_configured_proxy
bool matches_configured_proxy(const std::string& host, std::uint16_t port)
Implements the matches configured proxy operation declared by this component.
7. Runtime Flow
- Read standard lower- and uppercase proxy environment variables
- Parse proxy URLs into scheme, host, and port
- Inspect supported environment/configuration files
- Normalize and deduplicate endpoints
- Cache the detected list once per process
- Compare connection destinations against known proxy endpoints
8. Runtime and Security Considerations
- Normalizes hostnames before comparison.
- Does not retain credentials as part of the endpoint identity.
- Centralizes proxy detection so alert attribution can distinguish proxy connections.
9. Error Handling and Operational Notes
- Errors are propagated through the return type, callbacks, or the owning controller.
10. Source Integrity
Relative source path: util/ProxyDetect.hpp
SHA-256:
be1eacf78a3223f3cb8dc86fd193401d1c49dfe17d9c72b62c436a1f37d92374
11. Licensing
The source header identifies this component as distributed under the GNU General Public License version 3. BastionGuard branding and trademarks remain subject to the notices stated in the source file.
