MCPcopy Index your code
hub / github.com/ezh0v/socks5

github.com/ezh0v/socks5 @v0.9.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.9.3 ↗ · + Follow
146 symbols 307 edges 20 files 7 documented · 5%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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/ezh0v/socks5

Getting Started

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

package main

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

    "github.com/ezh0v/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

Extension points exported contracts — how you extend this code

Logger (Interface)
(no doc) [2 implementers]
logger.go
Driver (Interface)
(no doc) [2 implementers]
driver.go
Store (Interface)
(no doc) [1 implementers]
store.go
Metrics (Interface)
(no doc) [1 implementers]
metrics.go
Rules (Interface)
(no doc) [1 implementers]
rules.go
Option (FuncType)
(no doc)
options.go

Core symbols most depended-on inside this repo

Error
called by 60
logger.go
String
called by 14
address.go
WithLogger
called by 11
options.go
replyRequest
called by 11
socks5.go
WithPort
called by 10
options.go
readByte
called by 10
connection.go
read
called by 7
connection.go
response
called by 6
socks5.go

Shape

Method 72
Function 46
Struct 17
Interface 6
TypeAlias 4
FuncType 1

Languages

Go100%

Modules by API surface

options.go27 symbols
logger.go13 symbols
helpers_test.go12 symbols
driver.go10 symbols
server.go9 symbols
rules.go9 symbols
connection.go9 symbols
socks5.go7 symbols
nat.go7 symbols
packet.go6 symbols
metrics.go6 symbols
address.go6 symbols

For agents

$ claude mcp add socks5 \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact