• Stars
    star
    502
  • Rank 87,851 (Top 2 %)
  • Language
    Go
  • License
    BSD 2-Clause "Sim...
  • Created over 12 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A SOCKS (SOCKS4, SOCKS4A and SOCKS5) Proxy Package for Go

SOCKS

GoDoc

A SOCKS is a SOCKS4, SOCKS4A and SOCKS5 proxy package for Go.

The package provides socks.Dial which returns a TCP dialing function from a socks proxy connection string. The returned dialing function can then be used to establish a TCP connection via the socks proxy or be used to initialize http.Transport for an HTTP connection.

Quick Start

Get the package

go get -u "h12.io/socks"

Import the package

import "h12.io/socks"

Create a SOCKS proxy dialing function

dialSocksProxy := socks.Dial("socks5://127.0.0.1:1080?timeout=5s")
tr := &http.Transport{Dial: dialSocksProxy}
httpClient := &http.Client{Transport: tr}

User/password authentication

dialSocksProxy := socks.Dial("socks5://user:[email protected]:1080?timeout=5s")

Example

package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"

	"h12.io/socks"
)

func main() {
	dialSocksProxy := socks.Dial("socks5://127.0.0.1:1080?timeout=5s")
	tr := &http.Transport{Dial: dialSocksProxy}
	httpClient := &http.Client{Transport: tr}
	resp, err := httpClient.Get("http://www.google.com")
	if err != nil {
		log.Fatal(err)
	}
	defer resp.Body.Close()
	if resp.StatusCode != http.StatusOK {
		log.Fatal(resp.StatusCode)
	}
	buf, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(string(buf))
}

More Repositories

1

cwrap

Wraps C libraries in Go.
Go
116
star
2

html-query

A fluent and functional approach to querying HTML
Go
49
star
3

gosweep

A shell script to do various checks on Go code.
Shell
34
star
4

kpax

A modular & idiomatic Kafka client in Go
Go
21
star
5

gspec

GSpec is an expressive, reliable, concurrent and extensible Go test framework that makes it productive to organize and verify the mind model of software.
Go
11
star
6

go-zip

A Go wrapper around C library libzip. It tries to mimic standard library "archive/zip" but provides ability to modify existing ZIP archives.
Go
10
star
7

gombi

Creating Your Own Parser is Easier than Regular Expressions
Go
9
star
8

sqlite-benchmark

Performance tests for bulk insert into SQLite memory database in Go.
Go
8
star
9

getgo

A concurrent web scrapper framework in Go
Go
8
star
10

xsd

XML tagged struct generator for Go
Go
7
star
11

dfa

DFA: a fast and modular replacement for regular expressions
Go
6
star
12

sej

A File-based Segmented Journal (Queue)
Go
5
star
13

run

Graceful goroutine orchestration
Go
5
star
14

go-shapefile

Go binding to the shapefile library
Go
4
star
15

json-schema

Generate Go struct from JSON Schema
Go
4
star
16

go-gccxml

Go binding and extension to gccxml.
Go
3
star
17

realtest

Docker enabled real test environment for Go testing
Go
3
star
18

svg

An SVG manipulation package.
Go
2
star
19

color

A Go package for conversions between color spaces
Go
2
star
20

buid

Bipartite Unique Identifier
Go
2
star
21

misc

misc desgin document.
CSS
2
star
22

go-mupdf

Go wrapper for MuPDF
Go
2
star
23

graph

Some graph algorithms
Go
1
star
24

mitm

HTTPS Man-in-the-middle in Go
Go
1
star
25

teff

TEst Friendly Format: a data format for fluent testing experience
Go
1
star
26

gosx

Go development docker environment for Mac OSX
Shell
1
star
27

gengo

Gengo: Simple Go Code Generation
Go
1
star
28

docker-cubes-viewer

Dockerfile of CubesViewer
1
star
29

gs

gs: Go as a "scripting" language
Go
1
star
30

go-plplot

Go binding and extentions to PLPlot library
Go
1
star
31

wipro

Wire Protocol generator for Go
Go
1
star
32

chrome-var

Get JS variable value from Chrome browser
Go
1
star
33

json2csv

A CLI tool converting JSON lines to CSV
Go
1
star
34

gosurf

WebKit-enhanced Go crawler
Go
1
star
35

gexf

Go package of Graph Exchange XML Format
Go
1
star
36

vgob

condensed encoding by separating versioned values and schema based on encoding/gob
Go
1
star
37

retracer

URL Redirect Tracer
Go
1
star
38

iso-code

ISO country & language code in CSV format
1
star
39

ua

UA Parser in Go
Go
1
star
40

decimal

An enhanced wrapper to shopspring/decimal
Go
1
star
41

gr

Minimal PDF Reader Written in Go.
Go
1
star