emersion / go-milter

Go library to write mail filters
BSD 2-Clause "Simplified" License
42 stars 19 forks source link

v0.3.3: unable to run test: milter: negotiate: unsupported protocol version: 2 #29

Closed Isma399 closed 11 months ago

Isma399 commented 11 months ago

Hello,

I am writing a DKIM-milter (only signing), heavily inspired from : https://github.com/emersion/go-msgauth/tree/master/cmd/dkim-milter

I am using:

To be able to write test, I have started with clinet_test.go from v0.3.3 I have met this error:

milter: negotiate: unsupported protocol version: 2

I see that this value is hardcoded in server.go I have tested to change it while instancing Server:

s := emersionMilter.Server{
                NewMilter: func() emersionMilter.Milter {
                        return &mm
                },
                Actions:  emersionMilter.OptAddHeader | emersionMilter.OptChangeHeader,
                Protocol: 0x06,
        }

And downgrade clientVersion with:

cl := emersionMilter.NewClientWithOptions("tcp", local.Addr().String(), emersionMilter.ClientOptions{
                ActionMask: emersionMilter.OptAddHeader | emersionMilter.OptChangeHeader,
                cl := emersionMilter.NewClientWithOptions("tcp", local.Addr().String(), emersionMilter.ClientOptions{
                ActionMask: emersionMilter.OptAddHeader | emersionMilter.OptChangeHeader,
        })
        })

Because of this check:

 if milterVersion < clientProtocolVersion {
        return fmt.Errorf("milter: negotiate: unsupported protocol version: %v", milterVersion)
    }

But it fixed nothing..

Have you some hint to pass the test? Should I use master branch?

Thanks

emersion commented 11 months ago

Yeah, please try latest commit (I justt released a new version).

Isma399 commented 11 months ago

Thanks for being so fast! That works now.