@@ -37,9 +37,9 @@ const (
37
37
metricTemplate = `` +
38
38
`Bomberman - SMTP Performance Test Tool` + "\n " +
39
39
`--------------------------------------` + "\n " +
40
- `Message Count : %d` + "\n " +
41
- `Message Size : %dK` + "\n " +
40
+ `Count : %d` + "\n " +
42
41
`Error : %d` + "\n " +
42
+ `Size : %dK` + "\n " +
43
43
`Start : %v` + "\n " +
44
44
`End : %v` + "\n " +
45
45
`Time : %v` + "\n "
@@ -87,7 +87,7 @@ func usage() {
87
87
fmt .Fprintln (os .Stderr , "OPTIONS:" )
88
88
flag .PrintDefaults ()
89
89
fmt .Fprintln (os .Stderr , "USAGE:" )
90
- fmt .
Fprintln (
os .
Stderr ,
"./bomberman -host=mail.server.com:25 [email protected] [email protected] -workers=100 -jobs=100 -count=100 -outbound=YOUR_PUBLIC_IP - helo=mydomain.com -subject= \" Test Email \" " )
90
+ fmt .
Fprintln (
os .
Stderr ,
"./bomberman -host=mail.server.com:25 [email protected] [email protected] -workers=100 -jobs=100 -count=100 -helo=mydomain.com -balance -size=2 " )
91
91
fmt .Fprintln (os .Stderr , "" )
92
92
}
93
93
@@ -123,12 +123,10 @@ func printResults(balanced bool, startTime, endtime time.Time) {
123
123
}
124
124
125
125
if len (metric .DstIPStats ) > 1 {
126
-
127
126
fmt .Println ("" )
128
127
fmt .Println ("Destination IP Stats:" )
129
128
fmt .Println ("" )
130
129
printSlice (metric .DstIPStats , "%s\t : %d\n " )
131
-
132
130
}
133
131
134
132
fmt .Println ("" )
@@ -143,6 +141,7 @@ func printResults(balanced bool, startTime, endtime time.Time) {
143
141
cnt := countMetric (m , metric .Durations )
144
142
fmt .Printf ("%s (%d)\t : min. %v, max. %v, med. %v\n " , m , cnt , min , max , me )
145
143
}
144
+ fmt .Println ("" )
146
145
}
147
146
148
147
func start () {
@@ -187,9 +186,11 @@ func start() {
187
186
metric .ErrorCnt ++
188
187
}
189
188
190
- metric .DstIPStats = append (metric .DstIPStats , remoteip )
191
- metric .Durations = append (metric .Durations , durs )
189
+ if remoteip != "" {
190
+ metric .DstIPStats = append (metric .DstIPStats , remoteip )
191
+ }
192
192
193
+ metric .Durations = append (metric .Durations , durs )
193
194
}
194
195
}
195
196
@@ -267,12 +268,7 @@ func sendMail(outbound, smtpServer, from, to, subject, body, helo string) (metri
267
268
268
269
dataTime := time .Now ()
269
270
270
- msg = ""
271
- msg += fmt .Sprintf ("from: <%s>\r \n " , from )
272
- msg += fmt .Sprintf ("to: %s\r \n " , to )
273
- msg += fmt .Sprintf ("Subject: %s\r \n " , subject )
274
- msg += fmt .Sprintf ("\r \n %s" , body )
275
-
271
+ msg = fmt .Sprintf (bodyTemplate , from , to , subject , body )
276
272
wc , err = c .Data ()
277
273
278
274
if err != nil {
0 commit comments