fly

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2019 License: GPL-3.0 Imports: 19 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CipherMap = map[string]*cipherEntity{
	"aes-128-cfb":   {16, 16, newAESCFBStream},
	"aes-192-cfb":   {24, 16, newAESCFBStream},
	"aes-256-cfb":   {32, 16, newAESCFBStream},
	"aes-128-ctr":   {16, 16, newAESCTRStream},
	"aes-192-ctr":   {24, 16, newAESCTRStream},
	"aes-256-ctr":   {32, 16, newAESCTRStream},
	"rc4-md5":       {16, 16, newRC4MD5Stream},
	"rc4-md5-6":     {16, 6, newRC4MD5Stream},
	"chacha20":      {32, 8, newChaCha20Stream},
	"chacha20-ietf": {32, 12, newChaCha20Stream},
}
View Source
var (
	IV = []byte{0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f}
)

Functions

func AcceptErrorInfo

func AcceptErrorInfo() string

func CheckError

func CheckError(err error, info string)

just check error and print if err is not nil

func CheckErrorOrExit

func CheckErrorOrExit(err error, info string)

check error and exit if err is not nil

func CheckPort

func CheckPort(port string)

func EnableDebug

func EnableDebug(flag bool)

func EnableLog

func EnableLog(flag bool)

func GetLogger

func GetLogger() *log.Logger

return a logger

func GetPAC

func GetPAC() ([]byte, int)

return the stream and size of pac file

func InitLog

func InitLog()

func ListenTCP

func ListenTCP(localPort string) net.Listener

listen tcp port at the localPort

func ListenUDP

func ListenUDP(localPort string) net.Listener

listen udp port at the localPort

func PortForwardForClient

func PortForwardForClient(localPort, serverAddr string)

forward your local port to server port -- client

func PortForwardForServer

func PortForwardForServer(laborPort, queryPort string)

forward your local port to server port -- server

func PortOccupiedInfo

func PortOccupiedInfo(port string) string

get info about port occupied

func RelayTraffic

func RelayTraffic(dst, src net.Conn)

func SetLogName

func SetLogName(name string)

set log file name, which can include absolute path

func Socks5ForClientByTCP

func Socks5ForClientByTCP(localPort, serverAddr, method, key string, pacMode bool)

func Socks5ForClientByUDP

func Socks5ForClientByUDP(localPort, serverAddr string)

func Socks5ForServerByTCP

func Socks5ForServerByTCP(localPort, method, key string)

func Socks5ForServerByUDP

func Socks5ForServerByUDP(localPort string)

func StartHttp

func StartHttp(port string)

start http proxy at port

func StartSocks5

func StartSocks5(port string)

func TCPToUDP

func TCPToUDP(session *kcp.UDPSession, conn net.Conn)

func UDPToTCP

func UDPToTCP(conn net.Conn, session *kcp.UDPSession)

Types

type Cipher

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

func NewCipherInstance

func NewCipherInstance(secretKey, method string) *Cipher

func (*Cipher) Decrypt

func (cipher *Cipher) Decrypt(dst, src []byte)

func (*Cipher) Encrypt

func (cipher *Cipher) Encrypt(dst, src []byte)

type Conn

type Conn struct {
	net.Conn
	*Cipher
}

func DialWithAddr

func DialWithAddr(server, method, key string, addr []byte) *Conn

dial server and send request addr of client

func NewConn

func NewConn(con net.Conn, cipher *Cipher) *Conn

func (*Conn) Close

func (conn *Conn) Close() error

func (*Conn) Read

func (conn *Conn) Read(b []byte) (n int, err error)

func (*Conn) Write

func (conn *Conn) Write(b []byte) (n int, err error)

type EncOrDec

type EncOrDec int
const (
	ENC EncOrDec = iota
	DEC
)

Jump to

Keyboard shortcuts

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