mirror of
https://github.com/cbeuw/Cloak.git
synced 2024-11-17 15:25:30 +00:00
Avoid unnecessary pass by pointer
This commit is contained in:
parent
2bf7df0eb0
commit
a51d45f41a
@ -137,8 +137,8 @@ func MakeDeobfs(salsaKey [32]byte, payloadCipher cipher.AEAD) Deobfser {
|
|||||||
return deobfs
|
return deobfs
|
||||||
}
|
}
|
||||||
|
|
||||||
func MakeObfuscator(encryptionMethod byte, sessionKey [32]byte) (obfuscator *Obfuscator, err error) {
|
func MakeObfuscator(encryptionMethod byte, sessionKey [32]byte) (obfuscator Obfuscator, err error) {
|
||||||
obfuscator = &Obfuscator{
|
obfuscator = Obfuscator{
|
||||||
SessionKey: sessionKey,
|
SessionKey: sessionKey,
|
||||||
}
|
}
|
||||||
var payloadCipher cipher.AEAD
|
var payloadCipher cipher.AEAD
|
||||||
@ -164,7 +164,7 @@ func MakeObfuscator(encryptionMethod byte, sessionKey [32]byte) (obfuscator *Obf
|
|||||||
}
|
}
|
||||||
obfuscator.minOverhead = payloadCipher.Overhead()
|
obfuscator.minOverhead = payloadCipher.Overhead()
|
||||||
default:
|
default:
|
||||||
return nil, errors.New("Unknown encryption method")
|
return obfuscator, errors.New("Unknown encryption method")
|
||||||
}
|
}
|
||||||
|
|
||||||
obfuscator.Obfs = MakeObfs(sessionKey, payloadCipher)
|
obfuscator.Obfs = MakeObfs(sessionKey, payloadCipher)
|
||||||
|
@ -24,7 +24,7 @@ var errRepeatSessionClosing = errors.New("trying to close a closed session")
|
|||||||
type switchboardStrategy int
|
type switchboardStrategy int
|
||||||
|
|
||||||
type SessionConfig struct {
|
type SessionConfig struct {
|
||||||
*Obfuscator
|
Obfuscator
|
||||||
|
|
||||||
Valve
|
Valve
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user