Skip to content

SOCKS (SOCKS4, SOCKS4a, SOCKS5) proxy server written in Go

License

Notifications You must be signed in to change notification settings

romantomjak/go-socks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-socks

Build Status Coverage Status Go Report Card License

SOCKS (SOCKS4, SOCKS4a, SOCKS5) proxy library for Go


Requirements

  • Go 1.8

Client example

package main

import (
	"fmt"
	"io"

	"github.com/romantomjak/go-socks"
)

func main() {
	// 1. connect to a SOCKS server
	client, err := socks.NewV4Client("127.0.0.1:1234")
	if err != nil {
		panic(err)
	}

	// 2. instruct the server to relay connections to golang.org
	conn, err := client.Connect("142.250.187.241:80", "roman")
	if err != nil {
		panic(err)
	}
	defer conn.Close()

	// 3. fetch index.html via the relayed connection
	fmt.Fprintf(conn, "GET / HTTP/1.0\r\n\r\n")
	body, err := io.ReadAll(conn)
	if err != nil {
		panic(err)
	}
	fmt.Printf("%s\n", body)
}

Testing

$ go test

License

MIT

About

SOCKS (SOCKS4, SOCKS4a, SOCKS5) proxy server written in Go

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages