func (receiver *encryptedTCPReceiver) Receive() ([]byte, error) {
	msg, err := receiver.receiver.Receive()
	if err != nil {
		return nil, err
	}

	decodedMsg, success := secretbox.Open(nil, msg, &receiver.state.nonce, receiver.state.sessionKey)
	if !success {
		return nil, fmt.Errorf("Unable to decrypt TCP msg")
	}

	receiver.state.advance()
	return decodedMsg, nil
}
func (receiver *encryptedTCPReceiver) Receive() ([]byte, error) {
	msg, err := receiver.receiver.Receive()
	if err != nil {
		return nil, err
	}

	decodedMsg, success := secretbox.Open(nil, msg, &receiver.state.nonce, receiver.state.sessionKey)
	if !success {
		return nil, fmt.Errorf("Unable to decrypt TCP msg")
	}

	receiver.state.advance()
	return decodedMsg, nil
}
func ( receiver * encryptedTCPReceiver ) Receive ( ) ( [ ] byte , error ) { msg , err := receiver . receiver . Receive ( ) if err != nil { return nil , err } decodedMsg , success := secretbox . Open ( nil , msg , & receiver . state . nonce , receiver . state . sessionKey ) if ! success { return nil , fmt . Errorf ( " " ) } receiver . state . advance ( ) return decodedMsg , nil }
// Receive implements TCPReceiver by reading from the wrapped TCPReceiver and
// unboxing the encrypted message, returning the decoded message.
Receive implements TCPReceiver by reading from the wrapped TCPReceiver and unboxing the encrypted message returning the decoded message .