Esempio n. 1
0
// TestBinaryProtocolDecrypt ---
func TestBinaryProtocolDecrypt(*testing.T) {
	o := aes256cbc.New()
	b, err := o.Encrypt(_secret, _echoServerAddr)
	if err != nil {
		panic(err)
	}
	testProtocol(append(append([]byte{0}, byte(len(b))), b...), nil)
}
Esempio n. 2
0
func BenchmarkDecryptText(b *testing.B) {
	for i := 0; i < b.N; i++ {
		o := aes256cbc.New()
		_, err := o.DecryptString(_secret, _expectAESCiphertext)
		if err != nil {
			panic(err)
		}
	}
}
Esempio n. 3
0
// TestTextDecryptAES ---
func TestTextDecryptAES(t *testing.T) {
	o := aes256cbc.New()

	dec, err := o.DecryptString(_secret, _expectAESCiphertext)
	if err != nil {
		panic(err)
	}
	if !bytes.Equal(dec, _echoServerAddr) {
		panic(errors.New("not match"))
	}
}
Esempio n. 4
0
func encryptText(plaintext, passphrase []byte) ([]byte, error) {
	o := aes256cbc.New()

	return o.EncryptString(passphrase, plaintext)
}
Esempio n. 5
0
File: main.go Progetto: uin57/frontd
	_MaxOpenfile              = uint64(1024 * 1024 * 1024)
	_MaxBackendAddrCacheCount = 1024 * 1024
	_DefaultPort              = 4043
	_MTU                      = 1500
)

var (
	_hdrCipherOrigin   = []byte("x-cipher-origin")
	_hdrForwardedFor   = []byte("x-forwarded-for")
	_maxHTTPHeaderSize = 4096 * 2
	_minHTTPHeaderSize = 32
)

var (
	_SecretPassphase []byte
	_Aes256CBC       = aes256cbc.New()
)

var (
	_BackendAddrCacheMutex sync.Mutex
	_BackendAddrCache      atomic.Value
	_BufioReaderPool       sync.Pool
)

var (
	_BackendDialTimeout = 5
)

type backendAddrMap map[string][]byte

func main() {