1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- package main
- import (
- "fmt"
- "math/rand"
- "time"
- "github.com/flashmob/go-guerrilla/mocks"
- )
- const (
- URL = "127.0.0.1:2500"
- )
- var (
- helos = []string{"hi", "hello", "ahoy", "bonjour", "hey!", "whats up"}
- emails = []string{
- "[email protected]",
- "[email protected]",
- "[email protected]",
- "[email protected]",
- "[email protected]",
- "[email protected]",
- "[email protected]",
- "[email protected]",
- "[email protected]",
- "[email protected]",
- }
- )
- func main() {
- c := make(chan int)
- for i := 0; i < 100; i++ {
- go sendMailForever(time.Millisecond * time.Duration(rand.Int()%500))
- }
- <-c
- }
- func sendMailForever(wait time.Duration) {
- c := mocks.Client{
- Helo: helos[rand.Int()%len(helos)],
- EmailAddress: emails[rand.Int()%len(emails)],
- }
- fmt.Println(c)
- for {
- c.SendMail("[email protected]", URL)
- time.Sleep(wait)
- }
- }
|