Skip to content

A fully featured implementation of the SOCKS 5 protocol in golang. Command CONNECT βœ…, BIND πŸ› , UDP ASSOCIATE βœ….

License

Notifications You must be signed in to change notification settings

TuanKiri/socks5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

46 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Gopher socks logo

SOCKS 5

license go version go doc go report tests

Report Bug | Request Feature

A fully featured implementation of the SOCKS 5 protocol in golang.

CONNECT BIND UDP ASSOCIATE
βœ… - implemented πŸ›  - in progress βœ… - implemented
Gopher socks logo

Installation

go get github.com/TuanKiri/socks5

Getting Started

Create your .go file. For example: main.go.

package main

import (
	"context"
	"log"
	"os/signal"
	"syscall"

	"github.com/TuanKiri/socks5"
)

func main() {
	ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
	defer stop()

	srv := socks5.New()

	go func() {
		if err := srv.ListenAndServe(); err != nil {
			log.Fatal(err)
		}
	}()

	<-ctx.Done()

	if err := srv.Shutdown(); err != nil {
		log.Fatal(err)
	}
}

Run your server:

go run main.go

The following curl example shows how to use the proxy server:

curl -x socks5://127.0.0.1:1080 http://example.com

See the tests and examples for more information about package.

FAQ

  • Why can't connect to socks proxy server?

    Not all applications and browsers support socks authentication or socks protocol. You may need extension for Chrome or another browser.

If you have any questions, you can ask in GitHub Discussions.

Note

  • The proof of work for the UDP association was done using qBittorrent - a BitTorrent client.

Contributing

Feel free to open tickets or send pull requests with improvements. Thanks in advance for your help!

Please follow the contribution guidelines.

References

  • RFC 1928 SOCKS Protocol Version 5
  • RFC 1929 Username/Password Authentication for SOCKS V5

Licenses