@@ -207,7 +207,7 @@ func TestDownstreamDelivery_MAILErr(t *testing.T) {
207
207
testutils .CheckSMTPErr (t , err , 550 , exterrors.EnhancedCode {5 , 1 , 2 }, "Hey" )
208
208
}
209
209
210
- func TestDownstreamDelivery_AttemptTLS (t * testing.T ) {
210
+ func TestDownstreamDelivery_StartTLS (t * testing.T ) {
211
211
clientCfg , be , srv := testutils .SMTPServerSTARTTLS (t , "127.0.0.1:" + testPort )
212
212
defer srv .Close ()
213
213
defer testutils .CheckSMTPConnLeak (t , srv )
@@ -221,9 +221,9 @@ func TestDownstreamDelivery_AttemptTLS(t *testing.T) {
221
221
Port : testPort ,
222
222
},
223
223
},
224
- tlsConfig : * clientCfg .Clone (),
225
- attemptStartTLS : true ,
226
- log : testutils .Logger (t , "target.smtp" ),
224
+ tlsConfig : * clientCfg .Clone (),
225
+ starttls : true ,
226
+ log : testutils .Logger (t , "target.smtp" ),
227
227
}
228
228
229
229
testutils .
DoTestDelivery (
t ,
mod ,
"[email protected] " , []
string {
"[email protected] " })
@@ -235,85 +235,7 @@ func TestDownstreamDelivery_AttemptTLS(t *testing.T) {
235
235
}
236
236
}
237
237
238
- func TestDownstreamDelivery_AttemptTLS_Fallback (t * testing.T ) {
239
- be , srv := testutils .SMTPServer (t , "127.0.0.1:" + testPort )
240
- defer srv .Close ()
241
- defer testutils .CheckSMTPConnLeak (t , srv )
242
-
243
- mod := & Downstream {
244
- hostname : "mx.example.invalid" ,
245
- endpoints : []config.Endpoint {
246
- {
247
- Scheme : "tcp" ,
248
- Host : "127.0.0.1" ,
249
- Port : testPort ,
250
- },
251
- },
252
- attemptStartTLS : true ,
253
- log : testutils .Logger (t , "target.smtp" ),
254
- }
255
-
256
- testutils .
DoTestDelivery (
t ,
mod ,
"[email protected] " , []
string {
"[email protected] " })
257
- be .
CheckMsg (
t ,
0 ,
"[email protected] " , []
string {
"[email protected] " })
258
- }
259
-
260
- func TestDownstreamDelivery_RequireTLS (t * testing.T ) {
261
- clientCfg , be , srv := testutils .SMTPServerSTARTTLS (t , "127.0.0.1:" + testPort )
262
- defer srv .Close ()
263
- defer testutils .CheckSMTPConnLeak (t , srv )
264
-
265
- mod := & Downstream {
266
- hostname : "mx.example.invalid" ,
267
- endpoints : []config.Endpoint {
268
- {
269
- Scheme : "tcp" ,
270
- Host : "127.0.0.1" ,
271
- Port : testPort ,
272
- },
273
- },
274
- tlsConfig : * clientCfg .Clone (),
275
- attemptStartTLS : true ,
276
- requireTLS : true ,
277
- log : testutils .Logger (t , "target.smtp" ),
278
- }
279
-
280
- testutils .
DoTestDelivery (
t ,
mod ,
"[email protected] " , []
string {
"[email protected] " })
281
- be .
CheckMsg (
t ,
0 ,
"[email protected] " , []
string {
"[email protected] " })
282
- tlsState , ok := be .Messages [0 ].Conn .TLSConnectionState ()
283
- if ! ok || ! tlsState .HandshakeComplete {
284
- t .Fatal ("Message was not delivered over TLS" )
285
- }
286
- }
287
-
288
- func TestDownstreamDelivery_RequireTLS_Implicit (t * testing.T ) {
289
- clientCfg , be , srv := testutils .SMTPServerTLS (t , "127.0.0.1:" + testPort )
290
- defer srv .Close ()
291
- defer testutils .CheckSMTPConnLeak (t , srv )
292
-
293
- mod := & Downstream {
294
- hostname : "mx.example.invalid" ,
295
- endpoints : []config.Endpoint {
296
- {
297
- Scheme : "tls" ,
298
- Host : "127.0.0.1" ,
299
- Port : testPort ,
300
- },
301
- },
302
- tlsConfig : * clientCfg .Clone (),
303
- attemptStartTLS : true ,
304
- requireTLS : true ,
305
- log : testutils .Logger (t , "target.smtp" ),
306
- }
307
-
308
- testutils .
DoTestDelivery (
t ,
mod ,
"[email protected] " , []
string {
"[email protected] " })
309
- be .
CheckMsg (
t ,
0 ,
"[email protected] " , []
string {
"[email protected] " })
310
- tlsState , ok := be .Messages [0 ].Conn .TLSConnectionState ()
311
- if ! ok || ! tlsState .HandshakeComplete {
312
- t .Fatal ("Message was not delivered over TLS" )
313
- }
314
- }
315
-
316
- func TestDownstreamDelivery_RequireTLS_Fail (t * testing.T ) {
238
+ func TestDownstreamDelivery_StartTLS_NoFallback (t * testing.T ) {
317
239
_ , srv := testutils .SMTPServer (t , "127.0.0.1:" + testPort )
318
240
defer srv .Close ()
319
241
defer testutils .CheckSMTPConnLeak (t , srv )
@@ -327,9 +249,8 @@ func TestDownstreamDelivery_RequireTLS_Fail(t *testing.T) {
327
249
Port : testPort ,
328
250
},
329
251
},
330
- attemptStartTLS : true ,
331
- requireTLS : true ,
332
- log : testutils .Logger (t , "target.smtp" ),
252
+ starttls : true ,
253
+ log : testutils .Logger (t , "target.smtp" ),
333
254
}
334
255
335
256
_ ,
err := testutils .
DoTestDeliveryErr (
t ,
mod ,
"[email protected] " , []
string {
"[email protected] " })
0 commit comments