changed Writer and Reader method on encryption interceptor

This commit is contained in:
harshabose
2025-05-03 19:29:23 +05:30
parent 162c4108c2
commit 22bc39105d
2 changed files with 12 additions and 7 deletions

View File

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

View File

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