nethttp

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 14, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package nethttp exposes helpers that adapt decodo configuration and leases into proxy values accepted by the Go standard library net/http package.

Proxy URL

Convert a decodo Config into a *url.URL:

proxyURL, err := nethttpadapter.ProxyURL(config)

ProxyFunc

Obtain a net/http-compatible proxy function for use with http.Transport:

proxyFunc, err := nethttpadapter.ProxyFunc(config)

transport := &http.Transport{Proxy: proxyFunc}

SOCKS5 Support

net/http does not natively support SOCKS5. ProxyURLSOCKS5 returns a *url.URL suitable for use with a SOCKS5-capable dialer such as golang.org/x/net/proxy:

socks5URL, err := nethttpadapter.ProxyURLSOCKS5(config)

Then configure your transport's Dial field with the SOCKS5 dialer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProxyFunc

func ProxyFunc(config decodo.Config) (func(*http.Request) (*url.URL, error), error)

ProxyFunc returns a net/http-compatible proxy function from a Decodo config.

func ProxyFuncSOCKS5 added in v0.3.0

func ProxyFuncSOCKS5(config decodo.Config) (*url.URL, error)

ProxyFuncSOCKS5 returns a SOCKS5 proxy URL function for net/http. Note: net/http does not natively support SOCKS5. This returns the URL for use with a SOCKS5-capable dialer (e.g., golang.org/x/net/proxy).

func ProxyURL

func ProxyURL(config decodo.Config) (*url.URL, error)

ProxyURL converts a Decodo config into a URL usable by net/http proxy helpers.

func ProxyURLFromLease

func ProxyURLFromLease(lease decodo.Lease) (*url.URL, error)

ProxyURLFromLease parses the proxy URL stored in a lease.

func ProxyURLSOCKS5 added in v0.3.0

func ProxyURLSOCKS5(config decodo.Config) (*url.URL, error)

ProxyURLSOCKS5 converts a Decodo config into a SOCKS5 proxy URL. SOCKS5 always uses gate.decodo.com:7000 - targeting is done via username parameters.

func ProxyURLSOCKS5FromLease added in v0.3.0

func ProxyURLSOCKS5FromLease(lease decodo.Lease) (*url.URL, error)

ProxyURLSOCKS5FromLease converts an HTTP proxy URL stored in a lease to SOCKS5 format.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL