ladder

package module
v0.0.0-...-0086713 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2014 License: MIT Imports: 7 Imported by: 0

README

ladder

a nice proxy

Documentation

Index

Constants

View Source
const (
	SocksAddrTypeIPv4 = iota
	SocksAddrTypeIPv6
	SocksAddrTypeDomain
)
View Source
const SocksUPCheckVersion = 1
View Source
const SocksVersion = 5

Variables

View Source
var (
	SocksAuthNotRequired         = []byte{SocksVersion, 0}
	SocksAuthUserPasswd          = []byte{SocksVersion, 2}
	SocksAuthMethodNotMatch      = []byte{SocksVersion, 0xFF}
	SocksUPAuthSuccess           = []byte{SocksUPCheckVersion, 0}
	SocksUPAuthFail              = []byte{SocksUPCheckVersion, 1}
	SocksReplySuccess            = []byte{SocksVersion, 0, 0, 1, 0, 0, 0, 0, 0, 0}
	SocksReplyServerFail         = []byte{SocksVersion, 1, 0, 1, 0, 0, 0, 0, 0, 0}
	SocksReplyNotAllowed         = []byte{SocksVersion, 2, 0, 1, 0, 0, 0, 0, 0, 0}
	SocksReplyNetworkUnreachable = []byte{SocksVersion, 3, 0, 1, 0, 0, 0, 0, 0, 0}
	SocksReplyHostUnreachable    = []byte{SocksVersion, 4, 0, 1, 0, 0, 0, 0, 0, 0}
	SocksReplyRefused            = []byte{SocksVersion, 5, 0, 1, 0, 0, 0, 0, 0, 0}
	SocksReplyTTLExpired         = []byte{SocksVersion, 6, 0, 1, 0, 0, 0, 0, 0, 0}
	SocksReplyInvalidCommand     = []byte{SocksVersion, 7, 0, 1, 0, 0, 0, 0, 0, 0}
	SocksReplyInvalidAddrType    = []byte{SocksVersion, 8, 0, 1, 0, 0, 0, 0, 0, 0}
)

Functions

func RegisterEncryptorMaker

func RegisterEncryptorMaker(name string, f EncryptorMakerFunc)

Types

type Config

type Config map[string]interface{}

func NewConfig

func NewConfig(data []byte) (Config, error)

func NewConfigFromFile

func NewConfigFromFile(path string) (Config, error)

func (Config) Get

func (c Config) Get(name string) (interface{}, error)

func (Config) GetInt

func (c Config) GetInt(name string, result *int) error

func (Config) GetInt64

func (c Config) GetInt64(name string, result *int64) error

func (Config) GetString

func (c Config) GetString(name string, str *string) error

func (Config) GetSub

func (c Config) GetSub(name string) (Config, error)

func (Config) Has

func (c Config) Has(name string) bool

type ConfigInvalidType

type ConfigInvalidType struct {
	Item       string
	ExpectType string
	Value      string
}

func (*ConfigInvalidType) Error

func (c *ConfigInvalidType) Error() string

type ConfigNotFound

type ConfigNotFound struct {
	Item string
}

func (*ConfigNotFound) Error

func (c *ConfigNotFound) Error() string

type Encryptor

type Encryptor interface {
	Close() error
	Encrypt([]byte) ([]byte, error)
	Decrypt([]byte) ([]byte, error)
}

type EncryptorMaker

type EncryptorMaker interface {
	New() (Encryptor, error)
}

func GetEncryptorMaker

func GetEncryptorMaker(name string, cfg Config) (EncryptorMaker, error)

type EncryptorMakerFunc

type EncryptorMakerFunc func(Config) (EncryptorMaker, error)

type IOCopyStat

type IOCopyStat struct {
	// contains filtered or unexported fields
}

type SimpleAuth

type SimpleAuth map[string]string

func NewSimpleAuth

func NewSimpleAuth() SimpleAuth

func (SimpleAuth) Check

func (s SimpleAuth) Check(user, passwd string) bool

type Socks5ProxyResult

type Socks5ProxyResult struct {
	Up   int64
	Down int64
}

func HandleSocks5

func HandleSocks5(cli net.Conn, tun Tunnel, auth SocksAuth) *Socks5ProxyResult

type SocksAuth

type SocksAuth interface {
	Check(user, passwd string) bool
}

type Tunnel

type Tunnel interface {
	Init(cfg Config) error
	Shutdown() error
	NewSock(addr_type int, addr []byte, port uint16) TunnelSock
}

type TunnelSock

type TunnelSock interface {
	Read(b []byte) (n int, err error)
	Write(b []byte) (n int, err error)
	Close() error
	RemoteAddr() net.Addr
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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