go-socks5 Documentation

repository·master·Indexed 24 days ago

https://github.com/armon/go-socks5

A Go package that implements a SOCKS5 server for creating intermediate proxy layers to route traffic. Features include No Auth and User/Password authentication modes, CONNECT command support, granular filtering, and custom DNS resolution.

Tokens
334
Snippets
1
Records
2
Agent score
35%

What's inside go-socks5

  1. Features of the go-socks5 package

    master

    The socks5 package provides a SOCKS5 server implementation with the following capabilities:

    • No Auth mode: Default mode with no authentication required.
    • User/Password authentication: Support for verifying client credentials.
    • CONNECT command support: Ability to route traffic via the CONNECT command.
    • Granular filtering: Use rules to filter specific commands.
    • Custom DNS resolution: Ability to implement custom logic for resolving hostnames.
    • Unit tests: The package includes comprehensive testing.
  2. Create and run a simple SOCKS5 server

    master

    You can implement a SOCKS5 server by initializing a socks5.Config and passing it to socks5.New(). Once the server instance is created, use ListenAndServe to start the proxy on a specific network type and address.

    By default, an empty socks5.Config{} enables "No Auth" mode.

    // Create a SOCKS5 server
    conf := &socks5.Config{}
    server, err := socks5.New(conf)
    if err != nil {
      panic(err)
    }
    
    // Create SOCKS5 proxy on localhost port 8000
    if err := server.ListenAndServe("tcp", "127.0.0.1:8000"); err != nil {
      panic(err)
    }