socks5

package module
v0.0.0-...-4c89935 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2016 License: MIT Imports: 6 Imported by: 1

README

go-socks5 Build Status

Provides the socks5 package that implements a SOCKS5 server. SOCKS (Secure Sockets) is used to route traffic between a client and server through an intermediate proxy layer. This can be used to bypass firewalls or NATs.

Feature

The package has the following features:

  • "No Auth" mode
  • User/Password authentication
  • Support for the CONNECT command
  • Rules to do granular filtering of commands
  • Custom DNS resolution
  • Unit tests

TODO

The package still needs the following:

  • Support for the BIND command
  • Support for the ASSOCIATE command

Example

Below is a simple example of usage

// 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)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveToHost

func ResolveToHost(ip net.IP) string

func ResolveToHostCaching

func ResolveToHostCaching(ip net.IP) string

func ResolveToIp

func ResolveToIp(host string) (net.IP, error)

func ResolveToIpCaching

func ResolveToIpCaching(host string) (net.IP, error)

Types

type AddrSpec

type AddrSpec struct {
	FQDN      string
	IP        net.IP
	Port      int
	ProxyHost string
	// contains filtered or unexported fields
}

func HandleProtocol

func HandleProtocol(local net.Conn) (net.Conn, *AddrSpec, error)

Handle the Socks5 protocol (https://www.ietf.org/rfc/rfc1928.txt). Doesnt support bind or associate commands. Automatically responsed to the server with a noauth required reply.

If the protocol is negotiated successfully,

returns with an open connection to the remote location
and AddrSpec (remote host, ip, and port)

func (*AddrSpec) HostAndPort

func (addr *AddrSpec) HostAndPort() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址