Documentation ¶
Index ¶
- Constants
- Variables
- func CreateClientCredential(file string, d5s *D5ServConf, user string) (e error)
- func DetectFile(isServ bool) (string, bool)
- func DetectRunAsServ() bool
- func Generate_d5sFile(file string, d5sConf *D5ServConf) (e error)
- func IdentifierOf(con net.Conn) string
- func IsNotExist(file string) bool
- func IsValidHost(hostport string) (ok bool, err error)
- func NewClientMultiplexer() *multiplexer
- func NewConnWithHash(conn *net.TCPConn) *hashedConn
- func NewIdler(interval int, isClient bool) *idler
- func NewPushbackInputStream(conn net.Conn) *pushbackInputStream
- func NewSemaphore() *semaphore
- func NewServerMultiplexer() *multiplexer
- func NewSignalTunnel(conn *Conn, interval int) *signalTunnel
- func RSADecrypt(src []byte, priv *rsa.PrivateKey) (plain []byte, err error)
- func RSAEncrypt(src []byte, pub *rsa.PublicKey) (enc []byte, err error)
- func ReadFullByLen(len_inByte int, reader io.Reader) (buf []byte, err error)
- func SafeClose(conn net.Conn)
- func ThrowErr(e interface{})
- func ThrowIf(condition bool, e interface{})
- type Cipher
- type CipherFactory
- type Client
- type Conn
- type ConnPool
- type D5ClientConf
- type D5Params
- type D5ServConf
- type DHKeyPair
- type FieldDescriptor
- type ImportableFieldDesc
- type RSAKeyPair
- type S5Step1
- type Server
- type Session
- type SessionContainer
- type SessionMgr
- type TSPriority
Constants ¶
View Source
const ( RETRY_INTERVAL = time.Second * 5 REST_INTERVAL = RETRY_INTERVAL )
View Source
const ( D5 = 0xd5 IPV4 = byte(1) DOMAIN = byte(3) IPV6 = byte(4) SOCKS5_VER = byte(5) NULL = "" DMLEN1 = 384 DMLEN2 = TKSZ + 2 GENERAL_SO_TIMEOUT = 10 * time.Second TUN_PARAMS_LEN = 32 REQ_PROT_UNKNOWN = 1 REQ_PROT_SOCKS5 = 2 REQ_PROT_HTTP = 3 REQ_PROT_HTTP_T = 4 CRLF = "\r\n" HTTP_PROXY_VER_LINE = "HTTP/1.1 200 Connection established" HTTP_PROXY_AGENT = "Proxy-Agent: deblocus" )
View Source
const ( // frame action 8bit FRAME_ACTION_CLOSE = iota FRAME_ACTION_CLOSE_R FRAME_ACTION_CLOSE_W FRAME_ACTION_OPEN FRAME_ACTION_OPEN_N FRAME_ACTION_OPEN_Y FRAME_ACTION_DATA FRAME_ACTION_PING FRAME_ACTION_PONG FRAME_ACTION_SLOWDOWN = 0xff )
View Source
const ( WAITING_OPEN_TIMEOUT = GENERAL_SO_TIMEOUT * 2 FRAME_HEADER_LEN = 5 FRAME_MAX_LEN = 0xffff MUX_PENDING_CLOSE = -1 MUX_CLOSED = -2 )
View Source
const ( // idle error type ERR_PING_TIMEOUT = 0xe ERR_NEW_PING = 0xf ERR_UNKNOWN = 0x0 )
View Source
const ( TCP_CLOSE_R uint8 = 1 TCP_CLOSE_W uint8 = 1 << 1 TCP_CLOSED = TCP_CLOSE_R | TCP_CLOSE_W )
View Source
const ( // close code CLOSED_FORCE = iota CLOSED_WRITE CLOSED_BY_ERR )
View Source
const ( GENERATE_TOKEN_NUM = 16 TOKENS_FLOOR = 2 PARALLEL_TUN_QTY = 2 TKSZ = sha1.Size )
View Source
const ( CMD_HEADER_LEN = 16 CTL_PING = byte(1) CTL_PONG = byte(2) TOKEN_REQUEST = byte(5) TOKEN_REPLY = byte(6) CTL_PING_INTERVAL = 120 // time.Second DT_PING_INTERVAL = 90 )
View Source
const ( Bye = syscall.Signal(0xfffb8e) SER_KEY_TYPE = "deblocus/SERVER-PRIVATEKEY" USER_CREDENTIAL_TYPE = "deblocus/CLIENT-CREDENTIAL" WORD_d5p = "D5P" WORD_provider = "Provider" SIZE_UNIT = "BKMG" )
View Source
const (
TICKER_INTERVAL = time.Second * 15
)
Variables ¶
View Source
var ( // for main package injection VERSION uint32 VER_STRING string DEBUG bool )
View Source
var ( // socks5 exceptions INVALID_SOCKS5_HEADER = exception.New(0xff, "Invalid socks5 header") INVALID_SOCKS5_REQUEST = exception.New(0x07, "Invalid socks5 request") GENERAL_FAILURE = exception.New(0x01, "General failure") HOST_UNREACHABLE = exception.New(0x04, "Host is unreachable") )
View Source
var ( // D5 exceptions INVALID_D5PARAMS = exception.NewW("Invalid D5Params") D5SER_UNREACHABLE = exception.NewW("D5Server is unreachable") VALIDATION_FAILED = exception.NewW("Validation failed") NEGOTIATION_FAILED = exception.NewW("Negotiation failed") DATATUN_SESSION = exception.NewW("DT") INCONSISTENT_HASH = exception.NewW("Inconsistent hash") INCOMPATIBLE_VERSION = exception.NewW("Incompatible version") )
View Source
var ( ZERO_TIME = time.Time{} FILE_NOT_FOUND = exception.NewW("File not found") FILE_EXISTS = exception.NewW("File is already exists") INVALID_D5P_FRAGMENT = exception.NewW("Invalid d5p fragment") INVALID_D5C_FILE = exception.NewW("Invalid d5c file format") INVALID_D5S_FILE = exception.NewW("Invalid d5s file format") UNRECOGNIZED_SYMBOLS = exception.NewW("Unrecognized symbols") UNRECOGNIZED_DIRECTIVES = exception.NewW("Unrecognized directives") LOCAL_BIND_ERROR = exception.NewW("Local bind error") CONF_MISS = exception.NewW("Missed config") CONF_ERROR = exception.NewW("Error config") )
View Source
var (
SID_SEQ uint32
)
View Source
var (
UNSUPPORTED_CIPHER = exception.NewW("Unsupported cipher")
)
Functions ¶
func CreateClientCredential ¶
func CreateClientCredential(file string, d5s *D5ServConf, user string) (e error)
public for external
func DetectFile ¶
func DetectRunAsServ ¶
func DetectRunAsServ() bool
func Generate_d5sFile ¶
func Generate_d5sFile(file string, d5sConf *D5ServConf) (e error)
func IdentifierOf ¶
func IsNotExist ¶
func IsValidHost ¶
func NewClientMultiplexer ¶
func NewClientMultiplexer() *multiplexer
func NewConnWithHash ¶
func NewPushbackInputStream ¶
func NewSemaphore ¶
func NewSemaphore() *semaphore
func NewServerMultiplexer ¶
func NewServerMultiplexer() *multiplexer
func NewSignalTunnel ¶
func RSADecrypt ¶
func RSADecrypt(src []byte, priv *rsa.PrivateKey) (plain []byte, err error)
single block decrypt
func RSAEncrypt ¶
single block encrypt OAEP: must be less than 86byte base on RSA1024-OAEP_sha1
func ReadFullByLen ¶
read by the first segment indicated the following segment length len_inByte: first segment length in byte
Types ¶
type CipherFactory ¶
type CipherFactory struct {
// contains filtered or unexported fields
}
func NewCipherFactory ¶
func NewCipherFactory(name string, secret []byte) *CipherFactory
func (*CipherFactory) NewCipher ¶
func (c *CipherFactory) NewCipher(iv []byte) *Cipher
type Client ¶
type Client struct { State int32 // -1:aborted 0:working 1:requesting token // contains filtered or unexported fields }
func (*Client) ClientServe ¶
func (*Client) StartSigTun ¶
type ConnPool ¶
type ConnPool struct {
// contains filtered or unexported fields
}
func NewConnPool ¶
func NewConnPool() *ConnPool
type D5ClientConf ¶
type D5ClientConf struct { Listen string `importable:":9009"` Verbose int `importable:"1"` ListenAddr *net.TCPAddr D5PList []*D5Params }
client
type D5Params ¶
type D5Params struct {
// contains filtered or unexported fields
}
d5p
func (*D5Params) RemoteName ¶
type D5ServConf ¶
type D5ServConf struct { Listen string `importable:":9008"` AuthTable string `importable:"file:///PATH/YOUR_AUTH_FILE_PATH"` Algo string `importable:"AES128CFB"` ServerName string `importable:"SERVER_NAME"` Verbose int `importable:"1"` AuthSys auth.AuthSys RSAKeys *RSAKeyPair ListenAddr *net.TCPAddr }
Server
type DHKeyPair ¶
type DHKeyPair struct {
// contains filtered or unexported fields
}
func GenerateDHKeyPairs ¶
func GenerateDHKeyPairs() *DHKeyPair
type FieldDescriptor ¶
type FieldDescriptor struct {
// contains filtered or unexported fields
}
type ImportableFieldDesc ¶
type ImportableFieldDesc map[string]*FieldDescriptor
type RSAKeyPair ¶
type RSAKeyPair struct {
// contains filtered or unexported fields
}
func GenerateRSAKeyPair ¶
func GenerateRSAKeyPair() *RSAKeyPair
type S5Step1 ¶
type S5Step1 struct {
// contains filtered or unexported fields
}
socks5 protocol step1 on client side
func (*S5Step1) HandshakeAck ¶
type Server ¶
type Server struct { *D5ServConf // contains filtered or unexported fields }
Server
func NewServer ¶
func NewServer(d5s *D5ServConf, dhKeys *DHKeyPair) *Server
func (*Server) TunnelServe ¶
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session
func NewSession ¶
func NewSession(tun *Conn, cf *CipherFactory, identity string) *Session
func (*Session) DataTunServe ¶
type SessionContainer ¶
type SessionMgr ¶
type SessionMgr struct {
// contains filtered or unexported fields
}
SessionMgr
func NewSessionMgr ¶
func NewSessionMgr() *SessionMgr
type TSPriority ¶
type TSPriority struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.