proxy

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: MIT Imports: 6 Imported by: 0

README

go-proxy

Go library for fetching free HTTP, SOCKS4, and SOCKS5 proxy lists from the ProxyScrape API with automatic gzip decompression.

Installation

go get github.com/eslider/go-proxy

Quick Start

proxies, _ := proxy.Fetch()
fmt.Printf("Found %d proxies\n", proxies.Len())

list, _ := proxies.List()
for _, p := range list {
    fmt.Printf("%s (country: %s, uptime: %.1f%%)\n", p.Address(), p.Country, p.Uptime)
}

API

Function / Method Description
Fetch() Fetch proxy list from ProxyScrape API
Proxies.Len() Total proxy count (HTTP + SOCKS4 + SOCKS5)
Proxies.List() All HTTP proxies as []*Proxy
Proxy.Address() Returns host:port string

License

MIT

Documentation

Overview

Package proxy fetches free HTTP, SOCKS4, and SOCKS5 proxy lists from the ProxyScrape API with automatic gzip decompression.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Proxies

type Proxies struct {
	HTTP   entry `json:"http"`
	SOCKS4 entry `json:"socks4"`
	SOCKS5 entry `json:"socks5"`
}

Proxies holds proxy lists grouped by protocol type.

func Fetch

func Fetch() (l *Proxies, err error)

Fetch retrieves the current proxy list from the ProxyScrape API.

func List

func List() (l *Proxies, err error)

List is a convenience function that fetches and returns all HTTP proxies. Deprecated: Use Fetch() and Proxies.List() for more control.

func (*Proxies) Len

func (receiver *Proxies) Len() int

Len returns the total number of proxies across all protocols.

func (*Proxies) List

func (receiver *Proxies) List() (l []*Proxy, err error)

List returns all HTTP proxies as a flat slice with host and port populated.

type Proxy

type Proxy struct {
	Host       string  `json:"host"`
	Port       int     `json:"port"`
	Country    string  `json:"country"`
	Timeout    float64 `json:"timeout"`
	LastSeen   float64 `json:"last_seen"`
	Uptime     float64 `json:"uptime"`
	AliveSince float64 `json:"alive_since"`
}

Proxy describes a single proxy server with its connection details and health metrics.

func (*Proxy) Address

func (p *Proxy) Address() string

Address returns the host:port string for this proxy.

Jump to

Keyboard shortcuts

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