refactor: simplify NewNaClEncryptor
- rely on default nil values on initialisation - inline
This commit is contained in:
1 parent
9992992ee4
commit
9a462f9d87
1 file changed
+6
-16
+6
-16
@@ -308,24 +308,14 @@ func (nd *NonDecryptor) ReceiveNonce(msg []byte) {
|
||||
}
|
||||
|
||||
func NewNaClDecryptor(conn *LocalConnection) *NaClDecryptor {
|
||||
inst := NaClDecryptorInstance{
|
||||
nonce: nil,
|
||||
previousNonce: nil,
|
||||
usedOffsets: bit.New(),
|
||||
previousUsedOffsets: nil,
|
||||
highestOffsetSeen: 0,
|
||||
nonceChan: make(chan *[24]byte, ChannelSize)}
|
||||
instDF := NaClDecryptorInstance{
|
||||
nonce: nil,
|
||||
previousNonce: nil,
|
||||
usedOffsets: bit.New(),
|
||||
previousUsedOffsets: nil,
|
||||
highestOffsetSeen: 0,
|
||||
nonceChan: make(chan *[24]byte, ChannelSize)}
|
||||
return &NaClDecryptor{
|
||||
NonDecryptor: *NewNonDecryptor(conn),
|
||||
instance: &inst,
|
||||
instanceDF: &instDF}
|
||||
instance: &NaClDecryptorInstance{
|
||||
usedOffsets: bit.New(),
|
||||
nonceChan: make(chan *[24]byte, ChannelSize)},
|
||||
instanceDF: &NaClDecryptorInstance{
|
||||
usedOffsets: bit.New(),
|
||||
nonceChan: make(chan *[24]byte, ChannelSize)}}
|
||||
}
|
||||
|
||||
func (nd *NaClDecryptor) Shutdown() {
|
||||
|
||||
Reference in new issue
Block a user