transx/cipher/cipher.go

24 lines
383 B
Go
Raw Normal View History

package cipher
import (
"net"
)
type Cipher interface {
Decrypt(data []byte) (decrypted []byte, err error)
Encrypt(data []byte) (encryped []byte, err error)
}
type Carrier struct {
Conn net.Conn
Cipher Cipher
Cache []byte
}
func NewCipher(cipherName string) (cipher Cipher) {
if cipherName == "default" {
return NewChaCha()
}
return nil //TODO:临时这样处理
}