Avoid unnecessary pass by pointer

This commit is contained in:
Andy Wang 2020-04-10 16:09:05 +01:00
parent 2bf7df0eb0
commit a51d45f41a
2 changed files with 4 additions and 4 deletions

View File

@ -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)

View File

@ -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