proxy

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2017 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const IV_LENGTH = 16

Variables

View Source
var (
	OK200 = []byte("HTTP/1.0 200 OK\r\n\r\n")
)

Functions

func ADecrypt

func ADecrypt(buf []byte) []byte

func ADecryptString

func ADecryptString(text string) string

func AEncrypt

func AEncrypt(buf []byte) []byte

func AEncryptString

func AEncryptString(text string) string

func Base35Decode

func Base35Decode(text string) []byte

func Base35Encode

func Base35Encode(buf []byte) string

func DecryptHost

func DecryptHost(text, mark string) string

func DecryptRequest

func DecryptRequest(req *http.Request) string

func EncryptHost

func EncryptHost(text, mark string) string

func EncryptRequest

func EncryptRequest(req *http.Request) string

func NewRand

func NewRand() *rand.Rand

func RandomKey

func RandomKey() string

func ReverseRandomKey

func ReverseRandomKey(key string) []byte

func SafeAddHeader

func SafeAddHeader(req *http.Request, k, v string)

func SafeGetHeader

func SafeGetHeader(req *http.Request, k string) string

func SplitHostPort

func SplitHostPort(host string) (string, string)

func StartClient

func StartClient(localaddr, upstream string)

func StartServer

func StartServer(addr string)

func TwoWayBridge

func TwoWayBridge(target, source net.Conn, key string, throttleTargetToSource bool)

func XorWrite

func XorWrite(w http.ResponseWriter, r *http.Request, p []byte, code int) (n int, err error)

Types

type IOCopyCipher

type IOCopyCipher struct {
	Dst        io.Writer
	Src        io.Reader
	Key        []byte
	Throttling *TokenBucket
	Partial    bool
}

func (*IOCopyCipher) DoCopy

func (cc *IOCopyCipher) DoCopy() (written int64, err error)

type IOReaderCipher

type IOReaderCipher struct {
	Src io.Reader
	Key []byte
	// contains filtered or unexported fields
}

func (*IOReaderCipher) Init

func (rc *IOReaderCipher) Init() *IOReaderCipher

func (*IOReaderCipher) Read

func (rc *IOReaderCipher) Read(p []byte) (n int, err error)

type InplaceCTR

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

func GetCipherStream

func GetCipherStream(key []byte) *InplaceCTR

func (*InplaceCTR) XorBuffer

func (x *InplaceCTR) XorBuffer(buf []byte)

From src/crypto/cipher/ctr.go

type ProxyHttpServer

type ProxyHttpServer struct {
	Tr       *http.Transport
	TrDirect *http.Transport
	Upstream string
}

func (*ProxyHttpServer) CanDirectConnect

func (proxy *ProxyHttpServer) CanDirectConnect(host string) bool

func (*ProxyHttpServer) ServeHTTP

func (proxy *ProxyHttpServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ProxyUpstreamHttpServer

type ProxyUpstreamHttpServer struct {
	Tr *http.Transport
}

func (*ProxyUpstreamHttpServer) ServeHTTP

func (proxy *ProxyUpstreamHttpServer) ServeHTTP(w http.ResponseWriter, r *http.Request)

type TokenBucket

type TokenBucket struct {
	Speed int64 // bytes per second
	// contains filtered or unexported fields
}

func NewTokenBucket

func NewTokenBucket(speed, max int64) *TokenBucket

func (*TokenBucket) Consume

func (tb *TokenBucket) Consume(n int64)

Jump to

Keyboard shortcuts

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