Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTransport ¶
func NewTransport(config ProxyConfig) (*http.Transport, error)
NewTransport creates a new http.Transport based on the provided ProxyConfig.
Types ¶
type Proxy ¶
type Proxy interface { // Apply configures the http.Transport with proxy settings. Apply(*http.Transport) error }
Proxy defines the interface for different proxy types.
func NewProxy ¶
func NewProxy(config ProxyConfig) (Proxy, error)
NewProxy creates a Proxy implementation based on the provided ProxyConfig.
type ProxyConfig ¶
type ProxyConfig struct { Type ProxyType Address string // e.g., "127.0.0.1:8080" for HTTP or "127.0.0.1:1080" for SOCKS5 Username string // Optional: For proxies that require authentication Password string // Optional: For proxies that require authentication Timeout time.Duration // Timeout for connections TLSConfig *tls.Config // Optional: For custom TLS settings DisableKeepAlives bool // Optional: To disable HTTP keep-alives CustomDialer proxy.Dialer // Optional: Allows injecting a custom dialer (useful for testing) }
ProxyConfig holds the configuration for the proxy.// ProxyConfig holds the configuration for the proxy.
type SOCKS5Proxy ¶
type SOCKS5Proxy struct { Address string Username string Password string Dialer proxy.Dialer // Allows injecting a custom dialer, useful for testing. Timeout time.Duration // This is your custom timeout for the SOCKS5 connection }
SOCKS5Proxy represents a SOCKS5 proxy configuration.
Click to show internal directories.
Click to hide internal directories.