socks5

package
v0.0.0-...-ea5c140 Latest Latest
Warning

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

Go to latest
Published: May 13, 2019 License: AGPL-3.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthFunc

type AuthFunc func(username, password string) (bool, interface{})

type CheckIPFunc

type CheckIPFunc func(ip net.IP) bool

type GenericCallbackFunc

type GenericCallbackFunc func(i interface{})

type Server

type Server struct {
	Port int

	// Workers are used to balance requests. There are two groups of subsequent workers: Authenticators and ReqHandlers.
	NumAuthWorkers      int
	NumReqHandleWorkers int

	// Size of the queue for the requests to be queue when all workers are idle. If the queue becomes full,
	// TCP listener blocks.
	ConnQueueSize int

	BufferSize             int
	ConnTimeLimit          time.Duration
	HandshakeStepTimeLimit time.Duration

	CheckIP CheckIPFunc

	// The 2 basic authentication methods in socks5 are the username/password subnegotiation and no authentication.
	// AuthMethodNoneAllowed will authenticate any requests that declare this method as valid.
	AuthMethodNoneAllowed bool

	// Returns a bool result of whether a request is authenticated.
	// It can also return a interface{} value that will be attached to a session and passed to
	// the callbacks when proxying starts and ends. This makes proxy sessions identifiable.
	Authenticate AuthFunc

	// The callback is called when the server starts proxying a session.
	// The value returned from AuthFunc is used as an argument for GenericCallbackFunc,
	// thus making it possible to store and handle data associated with a session.
	SessionStartCallback GenericCallbackFunc

	// Respectively to SessionStartCallback, SessionEndCallback is called once a session is canceled.
	SessionEndCallback GenericCallbackFunc

	LocalIP net.IP
	// contains filtered or unexported fields
}

func (*Server) GetCurrentData

func (srv *Server) GetCurrentData() (queue, authenticators, reqHandlers int)

func (*Server) ListenAndServe

func (srv *Server) ListenAndServe()

func (*Server) SetLogger

func (srv *Server) SetLogger(logger *log.Logger)

Jump to

Keyboard shortcuts

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