mirror of
https://github.com/harshabose/socket-comm.git
synced 2025-10-06 16:18:05 +08:00
changed Writer and Reader method on encryption interceptor
This commit is contained in:
@@ -65,13 +65,15 @@ func (i *Interceptor) Init(connection interceptor.Connection) error {
|
||||
|
||||
func (i *Interceptor) InterceptSocketWriter(writer interceptor.Writer) interceptor.Writer {
|
||||
return interceptor.WriterFunc(func(conn interceptor.Connection, msg message.Message) error {
|
||||
if i.localMessageRegistry.Check(msg.GetProtocol()) {
|
||||
return writer.Write(conn, msg)
|
||||
}
|
||||
var m *encryptor.EncryptedMessage
|
||||
|
||||
m, err := encryptor.NewEncryptedMessage(msg)
|
||||
if err != nil {
|
||||
return err
|
||||
if !i.localMessageRegistry.Check(msg.GetProtocol()) {
|
||||
m, err := encryptor.NewEncryptedMessage(msg)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
msg = m
|
||||
}
|
||||
|
||||
if err := m.WriteProcess(i, conn); err != nil {
|
||||
|
@@ -263,7 +263,10 @@ func NewDoneResponse() (*DoneResponse, error) {
|
||||
return msg, nil
|
||||
}
|
||||
|
||||
func (m *DoneResponse) Process(protocol interfaces.Protocol, s interfaces.State) error {
|
||||
// TODO: ADD WRITE OR READ PROCESS METHODS
|
||||
// TODO: ADD PROTOCOLS
|
||||
|
||||
func (m *DoneResponse) Process(protocol interfaces.Protocol, _ interfaces.State) error {
|
||||
p, ok := protocol.(*Curve25519Protocol)
|
||||
if !ok {
|
||||
return encryptionerr.ErrInvalidMessageType
|
||||
|
Reference in New Issue
Block a user