mirror of
https://gitlab.com/ric_harvey/MailHog.git
synced 2024-11-27 16:24:04 +00:00
Fix gotcha support (and some other bugs)
This commit is contained in:
parent
f95de548a4
commit
6f217359da
9 changed files with 472 additions and 479 deletions
|
@ -94,7 +94,7 @@
|
||||||
</div>
|
</div>
|
||||||
<ul class="nav navbar-nav navbar-left navbar-subtext">
|
<ul class="nav navbar-nav navbar-left navbar-subtext">
|
||||||
<li>
|
<li>
|
||||||
<a><%= config[Hostname] %></a>
|
<a>[: .config.Hostname :]</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a>{{ messagesDisplayed() }} {{ searchText ? "of " + messages.length : "" }} messages</a>
|
<a>{{ messagesDisplayed() }} {{ searchText ? "of " + messages.length : "" }} messages</a>
|
||||||
|
@ -140,6 +140,6 @@
|
||||||
<li><a target="_blank" href="https://github.com/ian-kent/Go-MailHog"><img src="/images/github.png" style="width: 16px;" /> GitHub</a></li>
|
<li><a target="_blank" href="https://github.com/ian-kent/Go-MailHog"><img src="/images/github.png" style="width: 16px;" /> GitHub</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
<%= content %>
|
[: .Content :]
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
310
bindata.go
310
bindata.go
|
@ -1,10 +1,10 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
)
|
)
|
||||||
|
|
||||||
func bindata_read(data []byte, name string) ([]byte, error) {
|
func bindata_read(data []byte, name string) ([]byte, error) {
|
||||||
|
@ -146,7 +146,7 @@ func assets_images_github_png() ([]byte, error) {
|
||||||
0x78, 0x66, 0xc1, 0xc3, 0xe0, 0xc4, 0x9e, 0xc9, 0x02, 0xaa, 0x45, 0x3c,
|
0x78, 0x66, 0xc1, 0xc3, 0xe0, 0xc4, 0x9e, 0xc9, 0x02, 0xaa, 0x45, 0x3c,
|
||||||
0x5d, 0xfd, 0x5c, 0xd6, 0x39, 0x25, 0x34, 0x01, 0x02, 0x00, 0x00, 0xff,
|
0x5d, 0xfd, 0x5c, 0xd6, 0x39, 0x25, 0x34, 0x01, 0x02, 0x00, 0x00, 0xff,
|
||||||
0xff, 0x8e, 0xf1, 0xda, 0x9d, 0xb2, 0x06, 0x00, 0x00,
|
0xff, 0x8e, 0xf1, 0xda, 0x9d, 0xb2, 0x06, 0x00, 0x00,
|
||||||
},
|
},
|
||||||
"assets/images/github.png",
|
"assets/images/github.png",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ func assets_images_ajax_loader_gif() ([]byte, error) {
|
||||||
0x93, 0x42, 0x69, 0x92, 0x44, 0xd3, 0xbc, 0x68, 0xc1, 0x09, 0x0c, 0x0c,
|
0x93, 0x42, 0x69, 0x92, 0x44, 0xd3, 0xbc, 0x68, 0xc1, 0x09, 0x0c, 0x0c,
|
||||||
0xd6, 0x0c, 0x30, 0x00, 0x08, 0x00, 0x00, 0xff, 0xff, 0xd9, 0x47, 0x25,
|
0xd6, 0x0c, 0x30, 0x00, 0x08, 0x00, 0x00, 0xff, 0xff, 0xd9, 0x47, 0x25,
|
||||||
0x03, 0xa1, 0x02, 0x00, 0x00,
|
0x03, 0xa1, 0x02, 0x00, 0x00,
|
||||||
},
|
},
|
||||||
"assets/images/ajax-loader.gif",
|
"assets/images/ajax-loader.gif",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -442,7 +442,7 @@ func assets_images_hog_png() ([]byte, error) {
|
||||||
0xa4, 0xfb, 0xa0, 0xb5, 0xe0, 0x9f, 0x03, 0x91, 0x05, 0x61, 0xd0, 0x58,
|
0xa4, 0xfb, 0xa0, 0xb5, 0xe0, 0x9f, 0x03, 0x91, 0x05, 0x61, 0xd0, 0x58,
|
||||||
0xa0, 0xc6, 0xdc, 0x2b, 0xe1, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x25,
|
0xa0, 0xc6, 0xdc, 0x2b, 0xe1, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x25,
|
||||||
0x6c, 0x2c, 0x59, 0xf6, 0x0a, 0x00, 0x00,
|
0x6c, 0x2c, 0x59, 0xf6, 0x0a, 0x00, 0x00,
|
||||||
},
|
},
|
||||||
"assets/images/hog.png",
|
"assets/images/hog.png",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -615,7 +615,7 @@ func assets_js_controllers_js() ([]byte, error) {
|
||||||
0x17, 0x30, 0x63, 0x9e, 0x7e, 0x7b, 0xb6, 0x93, 0xd1, 0x5a, 0x0d, 0x7e,
|
0x17, 0x30, 0x63, 0x9e, 0x7e, 0x7b, 0xb6, 0x93, 0xd1, 0x5a, 0x0d, 0x7e,
|
||||||
0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0x1b, 0x9b, 0xba, 0x50, 0xd2, 0x1c,
|
0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0x1b, 0x9b, 0xba, 0x50, 0xd2, 0x1c,
|
||||||
0x00, 0x00,
|
0x00, 0x00,
|
||||||
},
|
},
|
||||||
"assets/js/controllers.js",
|
"assets/js/controllers.js",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -814,7 +814,7 @@ func assets_templates_index_html() ([]byte, error) {
|
||||||
0x7f, 0x25, 0xea, 0xc1, 0xfc, 0x51, 0x12, 0xd1, 0x6f, 0xc0, 0x66, 0x33,
|
0x7f, 0x25, 0xea, 0xc1, 0xfc, 0x51, 0x12, 0xd1, 0x6f, 0xc0, 0x66, 0x33,
|
||||||
0x82, 0xc7, 0xce, 0xcc, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xbd, 0xa3,
|
0x82, 0xc7, 0xce, 0xcc, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xbd, 0xa3,
|
||||||
0x68, 0x5b, 0xc0, 0x21, 0x00, 0x00,
|
0x68, 0x5b, 0xc0, 0x21, 0x00, 0x00,
|
||||||
},
|
},
|
||||||
"assets/templates/index.html",
|
"assets/templates/index.html",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -822,150 +822,149 @@ func assets_templates_index_html() ([]byte, error) {
|
||||||
func assets_templates_layout_html() ([]byte, error) {
|
func assets_templates_layout_html() ([]byte, error) {
|
||||||
return bindata_read([]byte{
|
return bindata_read([]byte{
|
||||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x00, 0xff, 0xbc, 0x58,
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x00, 0xff, 0xbc, 0x58,
|
||||||
0xed, 0x6f, 0xd4, 0x3c, 0x12, 0xff, 0xce, 0x5f, 0xe1, 0x27, 0xa8, 0x6a,
|
0x6d, 0x6f, 0xd4, 0x3e, 0x12, 0x7f, 0xcf, 0xa7, 0x30, 0x41, 0xa7, 0xb6,
|
||||||
0xfb, 0x1c, 0x49, 0x76, 0x5b, 0xa8, 0xca, 0x76, 0x77, 0x11, 0x6a, 0x39,
|
0x1c, 0x49, 0x76, 0x5b, 0xa8, 0xca, 0x76, 0x77, 0x11, 0x6a, 0x39, 0x78,
|
||||||
0xf8, 0x72, 0x02, 0x1d, 0x7c, 0x39, 0x9d, 0x4e, 0xc8, 0x89, 0xbd, 0x89,
|
0x73, 0x02, 0x1d, 0xbc, 0x39, 0x9d, 0x10, 0x72, 0x62, 0x6f, 0xe2, 0xd6,
|
||||||
0x5b, 0xc7, 0xce, 0xd9, 0x4e, 0x69, 0xaf, 0xea, 0xff, 0x7e, 0x63, 0xe7,
|
0xb1, 0x73, 0xb6, 0x53, 0xda, 0xab, 0xfa, 0xdd, 0x6f, 0xec, 0x3c, 0x39,
|
||||||
0xcd, 0x79, 0xe9, 0x0b, 0x48, 0x3c, 0x42, 0xb0, 0x8e, 0x33, 0x33, 0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xbf, 0x15, 0x55, 0x37, 0x51, 0x2a, 0x8b, 0xb8, 0x5e,
|
||||||
0xf5, 0x32, 0x5c, 0x46, 0xcb, 0x65, 0xb4, 0x88, 0x0a, 0x26, 0xa2, 0x4b,
|
0x86, 0xcb, 0x68, 0xb9, 0x8c, 0x16, 0x51, 0xc1, 0x44, 0x74, 0xa1, 0x83,
|
||||||
0x1d, 0x6c, 0xd7, 0x71, 0xad, 0xf5, 0x2c, 0x13, 0x15, 0x8b, 0x41, 0x7d,
|
0xed, 0x3a, 0xae, 0xb5, 0x9e, 0x64, 0xa2, 0x62, 0x31, 0xa8, 0x2f, 0xa2,
|
||||||
0x11, 0xbd, 0x6e, 0x8d, 0x55, 0xec, 0x21, 0x43, 0x9c, 0x89, 0x2b, 0xa4,
|
0xd7, 0xad, 0xb1, 0x8a, 0xdd, 0x67, 0x88, 0x33, 0x71, 0x89, 0x14, 0xe5,
|
||||||
0x28, 0xdf, 0x04, 0xda, 0xdc, 0x72, 0xaa, 0x73, 0x4a, 0x4d, 0x80, 0x72,
|
0x9b, 0x40, 0x9b, 0x1b, 0x4e, 0x75, 0x4e, 0xa9, 0x09, 0x50, 0xae, 0xe8,
|
||||||
0x45, 0x77, 0x8f, 0x1b, 0x36, 0x39, 0x2d, 0xa8, 0x8e, 0x75, 0x21, 0xa5,
|
0xee, 0x61, 0xc3, 0x26, 0xa7, 0x05, 0xd5, 0xb1, 0x2e, 0xa4, 0x34, 0xb9,
|
||||||
0xc9, 0x05, 0xd5, 0xda, 0x83, 0x4a, 0xb5, 0x0e, 0x9e, 0x65, 0x5e, 0x50,
|
0xa0, 0x5a, 0x7b, 0x50, 0xa9, 0xd6, 0xc1, 0x93, 0xcc, 0x0b, 0x6a, 0x88,
|
||||||
0x43, 0x04, 0x8e, 0x12, 0xb0, 0xa1, 0x8d, 0xc2, 0x65, 0x4a, 0x84, 0x83,
|
0xc0, 0x51, 0x02, 0x36, 0xb4, 0x51, 0xb8, 0x4c, 0x89, 0x70, 0x30, 0xdd,
|
||||||
0xe9, 0x36, 0xe2, 0xe3, 0x08, 0xf0, 0x62, 0x30, 0xd8, 0xef, 0xb9, 0x48,
|
0x46, 0x7c, 0x14, 0x01, 0x5e, 0x0c, 0x06, 0xfb, 0x3d, 0x17, 0xc9, 0x9f,
|
||||||
0x7e, 0x2f, 0x44, 0xe8, 0xa2, 0x1b, 0x03, 0x0d, 0x73, 0xfe, 0x5c, 0xc3,
|
0x85, 0x08, 0x5d, 0x74, 0x63, 0xa0, 0x61, 0xce, 0x9f, 0x6a, 0xf8, 0x62,
|
||||||
0x97, 0x63, 0xd7, 0x9f, 0x3e, 0x4d, 0x22, 0x2e, 0x75, 0x94, 0x72, 0x59,
|
0xec, 0xfa, 0xe3, 0xa7, 0x49, 0xc4, 0x85, 0x8e, 0x52, 0x2e, 0x2b, 0xb2,
|
||||||
0x91, 0x1d, 0xc7, 0x8a, 0x3a, 0xb3, 0xf8, 0x12, 0xdf, 0xc4, 0x9c, 0x25,
|
0xe3, 0x58, 0x51, 0x67, 0x16, 0x5f, 0xe0, 0xeb, 0x98, 0xb3, 0x44, 0xc7,
|
||||||
0x3a, 0xc6, 0x22, 0xab, 0x60, 0x1b, 0xec, 0xc0, 0x59, 0x1c, 0x45, 0xcb,
|
0x58, 0x64, 0x15, 0x6c, 0x83, 0x1d, 0x38, 0x8b, 0xc3, 0x68, 0xf9, 0xc6,
|
||||||
0x37, 0xde, 0xce, 0xe3, 0x96, 0x41, 0x23, 0x95, 0xc2, 0x28, 0xc9, 0x39,
|
0xdb, 0x79, 0xd8, 0x32, 0x68, 0xa4, 0x52, 0x18, 0x25, 0x39, 0xa7, 0x4a,
|
||||||
0x55, 0x7a, 0x56, 0xdc, 0x66, 0xb0, 0x5e, 0x23, 0x94, 0x48, 0x72, 0xfb,
|
0xcf, 0x8a, 0xdb, 0x0c, 0xd6, 0x6b, 0x84, 0x12, 0x49, 0x6e, 0x5e, 0xb9,
|
||||||
0xca, 0x95, 0x3d, 0xba, 0x43, 0x39, 0x65, 0x59, 0x6e, 0x56, 0x68, 0xb9,
|
0xb2, 0x47, 0xb7, 0x28, 0xa7, 0x2c, 0xcb, 0xcd, 0x0a, 0x2d, 0x17, 0x8b,
|
||||||
0x58, 0xec, 0x9d, 0x21, 0x79, 0x4d, 0xd5, 0x8e, 0xcb, 0x1f, 0x2b, 0x94,
|
0xbf, 0x9d, 0x22, 0x79, 0x45, 0xd5, 0x8e, 0xcb, 0x9f, 0x2b, 0x94, 0x33,
|
||||||
0x33, 0x42, 0xa8, 0x38, 0x43, 0xf7, 0x8d, 0x52, 0x24, 0xf0, 0x75, 0x82,
|
0x42, 0xa8, 0x38, 0x45, 0x77, 0x8d, 0x52, 0x24, 0xf0, 0x55, 0x82, 0x15,
|
||||||
0x15, 0xba, 0x6b, 0x9e, 0x11, 0x2a, 0xb0, 0xca, 0x98, 0x08, 0x13, 0x69,
|
0xba, 0x6d, 0x9e, 0x11, 0x2a, 0xb0, 0xca, 0x98, 0x08, 0x13, 0x69, 0x8c,
|
||||||
0x8c, 0x2c, 0x56, 0x68, 0x71, 0xd6, 0xbd, 0x29, 0xa5, 0x66, 0x86, 0x49,
|
0x2c, 0x56, 0x68, 0x71, 0xda, 0xbd, 0x29, 0xa5, 0x66, 0x86, 0x49, 0xb1,
|
||||||
0xb1, 0x42, 0x38, 0xd1, 0x92, 0x57, 0x86, 0xf6, 0xef, 0x8c, 0x2c, 0x07,
|
0x42, 0x38, 0xd1, 0x92, 0x57, 0x86, 0xf6, 0xef, 0x8c, 0x2c, 0x07, 0xb2,
|
||||||
0xb2, 0xaa, 0x86, 0xf7, 0x76, 0x7e, 0x30, 0x62, 0xf2, 0xc6, 0xa1, 0x6e,
|
0xaa, 0x86, 0xf7, 0x76, 0x7e, 0x32, 0x62, 0xf2, 0xc6, 0xa1, 0x6e, 0x33,
|
||||||
0x33, 0x91, 0x8a, 0x50, 0xd5, 0x81, 0x2d, 0xcb, 0x1b, 0x04, 0x96, 0x19,
|
0x91, 0x8a, 0x50, 0xd5, 0x81, 0x2d, 0xcb, 0x6b, 0x04, 0x96, 0x19, 0x41,
|
||||||
0x41, 0x2f, 0xd3, 0x34, 0x6d, 0xc5, 0x46, 0xbe, 0x86, 0xf6, 0xd6, 0x52,
|
0x2f, 0xd2, 0x34, 0x6d, 0xc5, 0x46, 0xbe, 0x86, 0xf6, 0xd6, 0x52, 0x85,
|
||||||
0x85, 0x58, 0x91, 0x79, 0x6e, 0xb7, 0x01, 0x1f, 0xbf, 0x29, 0x6f, 0xce,
|
0x58, 0x91, 0x79, 0x6e, 0xb7, 0x01, 0x1f, 0xbd, 0x29, 0xaf, 0x4f, 0x47,
|
||||||
0x46, 0xc1, 0xac, 0xd0, 0x29, 0x18, 0x5e, 0xc0, 0x9f, 0xc1, 0x4b, 0xc8,
|
0xc1, 0xac, 0xd0, 0x09, 0x18, 0x5e, 0xc0, 0x9f, 0xc1, 0x4b, 0xc8, 0x08,
|
||||||
0x08, 0x06, 0x0d, 0x4e, 0x77, 0xe6, 0x21, 0x28, 0xf8, 0x69, 0x97, 0x75,
|
0x06, 0x0d, 0x4e, 0x77, 0xe6, 0x3e, 0x28, 0xf8, 0x69, 0x97, 0x75, 0x44,
|
||||||
0x44, 0x1c, 0x6b, 0x13, 0xa6, 0x39, 0xe3, 0x64, 0x9a, 0xb2, 0x2e, 0x66,
|
0x1c, 0x6b, 0x13, 0xa6, 0x39, 0xe3, 0x64, 0x9a, 0xb2, 0x2e, 0x66, 0x14,
|
||||||
0x14, 0xff, 0x89, 0xba, 0x22, 0x42, 0x3b, 0x76, 0xf3, 0xee, 0x0f, 0xf4,
|
0xbf, 0x44, 0x5d, 0x11, 0xa1, 0x1d, 0xbb, 0x7e, 0xf7, 0x1c, 0xbd, 0x8c,
|
||||||
0x67, 0x3c, 0x86, 0xb0, 0x25, 0x12, 0x82, 0x0b, 0x36, 0x96, 0xde, 0x56,
|
0xc7, 0x10, 0xb6, 0x44, 0x42, 0x70, 0xc1, 0xc6, 0xd2, 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c, 0xe0, 0x72, 0xe4,
|
0x23, 0xb8, 0x72, 0xcb, 0x41, 0x6a, 0x9a, 0x05, 0x5c, 0x8e, 0xdc, 0x98,
|
||||||
0xc6, 0x94, 0xab, 0x38, 0xd6, 0x06, 0x8a, 0xbd, 0xed, 0x4d, 0xae, 0x6d,
|
0x72, 0x15, 0xc7, 0xda, 0x40, 0xb1, 0xb7, 0xbd, 0xc9, 0xb5, 0x4d, 0xe0,
|
||||||
0x02, 0x27, 0x69, 0xdb, 0x62, 0xa0, 0x57, 0x9e, 0x9e, 0x1e, 0x9f, 0xbe,
|
0x24, 0x6d, 0x5b, 0x0c, 0xf4, 0xca, 0x93, 0x93, 0xa3, 0x93, 0xb7, 0xc7,
|
||||||
0x3d, 0x79, 0x1d, 0x83, 0xbd, 0xb0, 0xef, 0xf4, 0x5d, 0x80, 0xa1, 0x91,
|
0xaf, 0x63, 0xb0, 0x17, 0xf6, 0x9d, 0xbe, 0x0b, 0x30, 0x34, 0x32, 0x64,
|
||||||
0x21, 0x13, 0x65, 0x65, 0xe0, 0xe5, 0x4d, 0x7f, 0xbb, 0x22, 0x9b, 0x51,
|
0xa2, 0xac, 0x0c, 0xbc, 0xbc, 0xee, 0x6f, 0x57, 0x64, 0x33, 0x0a, 0x2f,
|
||||||
0x78, 0x21, 0xa0, 0xab, 0x80, 0xe6, 0x20, 0x11, 0x7e, 0x07, 0x03, 0x02,
|
0x04, 0x74, 0x15, 0xd0, 0x1c, 0x24, 0xc2, 0xef, 0x60, 0x40, 0x40, 0xd8,
|
||||||
0xc2, 0x86, 0x5d, 0xd3, 0x49, 0x80, 0x13, 0x7d, 0x07, 0x32, 0xb4, 0x32,
|
0xb0, 0x2b, 0x3a, 0x09, 0x70, 0xa2, 0xef, 0x40, 0x86, 0x56, 0x06, 0xc7,
|
||||||
0x38, 0xfe, 0x63, 0x1b, 0xa3, 0xdd, 0x7e, 0xda, 0xd2, 0xc0, 0x4a, 0x9b,
|
0x7f, 0x64, 0x63, 0xb4, 0xdb, 0x8f, 0x5b, 0x1a, 0x58, 0x69, 0xb3, 0x8c,
|
||||||
0x65, 0x8c, 0xf1, 0xd9, 0xac, 0x8b, 0xd3, 0x26, 0xeb, 0x65, 0xf7, 0xed,
|
0x31, 0x3e, 0x9d, 0x75, 0x71, 0xda, 0x64, 0xbd, 0xec, 0xbe, 0x1d, 0x65,
|
||||||
0x28, 0xbb, 0xb5, 0x2a, 0x13, 0x06, 0xd0, 0x5c, 0xd9, 0xe9, 0x15, 0x12,
|
0xb7, 0x56, 0x65, 0xc2, 0x00, 0x9a, 0x2b, 0x3b, 0xbd, 0x42, 0x42, 0x8a,
|
||||||
0x52, 0x4c, 0xe3, 0xa3, 0xd7, 0xdf, 0x33, 0x29, 0xfd, 0xee, 0xd5, 0x38,
|
0x69, 0x7c, 0xf4, 0xea, 0x47, 0x26, 0xa5, 0xdf, 0xbd, 0x1a, 0x47, 0x32,
|
||||||
0x92, 0x29, 0x0a, 0xc4, 0x30, 0x23, 0x9e, 0xe0, 0x19, 0x69, 0x45, 0xc9,
|
0x45, 0x81, 0x18, 0x66, 0xc4, 0x13, 0x3c, 0x23, 0xad, 0x28, 0x19, 0xca,
|
||||||
0x50, 0x16, 0x98, 0xa9, 0x25, 0xa3, 0x75, 0xdc, 0xce, 0x55, 0x6b, 0xcb,
|
0x02, 0x33, 0xb5, 0x64, 0xb4, 0x8e, 0xdb, 0xb9, 0x6a, 0x6d, 0x39, 0xc9,
|
||||||
0x49, 0x76, 0xfa, 0xea, 0x79, 0x6c, 0x13, 0xd8, 0x19, 0xeb, 0xdc, 0x28,
|
0x4e, 0x5f, 0x3d, 0x8f, 0x6d, 0x02, 0x3b, 0x63, 0x9d, 0x19, 0xc5, 0x5b,
|
||||||
0xde, 0xf2, 0x34, 0xf4, 0x57, 0x94, 0x42, 0x5f, 0xd5, 0x9b, 0xa0, 0x21,
|
0x9e, 0x86, 0xfe, 0x8a, 0x52, 0xe8, 0xab, 0x7a, 0x13, 0x34, 0x64, 0xd4,
|
||||||
0xa3, 0xa6, 0xe3, 0x12, 0xba, 0xc3, 0x15, 0x37, 0xed, 0x23, 0x54, 0x8b,
|
0x74, 0x5c, 0x42, 0x77, 0xb8, 0xe2, 0xa6, 0x7d, 0x84, 0x6a, 0x31, 0x2c,
|
||||||
0x61, 0x29, 0x9c, 0x7b, 0x19, 0x20, 0xb0, 0x45, 0x9d, 0x38, 0xcb, 0xb0,
|
0x85, 0x73, 0x2f, 0x03, 0x04, 0xb6, 0xa8, 0x13, 0x67, 0x19, 0xb6, 0xd9,
|
||||||
0xcd, 0x56, 0xd0, 0x92, 0xe0, 0x9a, 0xb0, 0x91, 0xb5, 0x86, 0x2e, 0x3a,
|
0x0a, 0x5a, 0x12, 0x5c, 0x13, 0x36, 0xb2, 0xd6, 0xd0, 0x45, 0x27, 0x01,
|
||||||
0x09, 0x90, 0xb1, 0xcc, 0x51, 0x53, 0x6c, 0xd3, 0x5b, 0x61, 0x26, 0x8c,
|
0x32, 0x96, 0x39, 0x6a, 0x8a, 0x6d, 0x7a, 0x2b, 0xcc, 0x84, 0x51, 0x29,
|
||||||
0x4a, 0x91, 0xf9, 0x32, 0x78, 0x64, 0x25, 0x51, 0x58, 0x90, 0x76, 0x4e,
|
0x32, 0x5f, 0x06, 0x8f, 0xac, 0x24, 0x0a, 0x0b, 0xd2, 0xce, 0x29, 0x2f,
|
||||||
0x79, 0x19, 0xf4, 0x93, 0x22, 0xee, 0xa0, 0x63, 0xc0, 0xee, 0x1e, 0x2a,
|
0x82, 0x7e, 0x52, 0xc4, 0x1d, 0x74, 0x0c, 0xd8, 0xdd, 0x43, 0xc5, 0x3d,
|
||||||
0xee, 0x19, 0x40, 0x3d, 0x9d, 0xb4, 0x4b, 0x5b, 0x1d, 0x5d, 0x64, 0x55,
|
0x03, 0xa8, 0xa7, 0x93, 0x76, 0x69, 0xab, 0xa3, 0x8b, 0xac, 0x4a, 0x0c,
|
||||||
0x62, 0xe8, 0x8d, 0xf1, 0xe1, 0x39, 0xdb, 0x7a, 0x27, 0xbb, 0xc6, 0xdb,
|
0xbd, 0x36, 0x3e, 0x3c, 0x67, 0x5b, 0xef, 0x64, 0xd7, 0x78, 0xfb, 0x9f,
|
||||||
0xf5, 0xde, 0x06, 0x72, 0x2f, 0x76, 0x2c, 0xfb, 0xf7, 0x27, 0xa9, 0x8d,
|
0x15, 0x82, 0x1b, 0x22, 0x76, 0x2c, 0x8b, 0x3e, 0x49, 0x6d, 0x04, 0x2e,
|
||||||
0xc0, 0x05, 0xfd, 0x0f, 0xda, 0xdb, 0x7a, 0xf8, 0xd6, 0x03, 0x5f, 0x6d,
|
0x28, 0x5a, 0x7d, 0xf7, 0xe0, 0xad, 0x03, 0xbe, 0xd6, 0xd4, 0xc4, 0xed,
|
||||||
0x6a, 0xe3, 0xee, 0x0e, 0xc1, 0x10, 0xa8, 0x6d, 0xc8, 0x17, 0x35, 0x0f,
|
0x2d, 0x82, 0x19, 0x50, 0xdb, 0x88, 0xcf, 0x6b, 0x1a, 0xa0, 0x64, 0xff,
|
||||||
0x50, 0x72, 0x70, 0x88, 0xee, 0xef, 0x11, 0xbc, 0xd1, 0x14, 0xab, 0x34,
|
0x00, 0xdd, 0xdd, 0x21, 0x78, 0xa3, 0x29, 0x56, 0x69, 0xfe, 0x0d, 0xdc,
|
||||||
0xff, 0x06, 0x7e, 0xa0, 0x77, 0x28, 0x90, 0x3b, 0x14, 0xa0, 0xbf, 0x75,
|
0x40, 0xef, 0x50, 0x20, 0x77, 0x28, 0x40, 0x7f, 0xef, 0xc4, 0xa1, 0x96,
|
||||||
0xe2, 0x50, 0xcc, 0x22, 0x33, 0x39, 0x5a, 0xa1, 0x20, 0xb0, 0xf2, 0xed,
|
0x45, 0x66, 0x72, 0xb4, 0x42, 0x41, 0x60, 0xe5, 0xdb, 0xfd, 0x7b, 0xe1,
|
||||||
0xfe, 0x83, 0xf0, 0xeb, 0xb8, 0xe2, 0xcf, 0xce, 0x85, 0x6b, 0x42, 0xc3,
|
0xd7, 0x71, 0xc5, 0x9f, 0x9c, 0x0a, 0xd7, 0x83, 0x86, 0xc1, 0xdb, 0x9a,
|
||||||
0xe8, 0x6d, 0xd1, 0x30, 0xc8, 0xb4, 0xab, 0xe5, 0x73, 0xa0, 0x43, 0x03,
|
0x61, 0x90, 0x68, 0x57, 0xca, 0x67, 0xc0, 0x86, 0x06, 0xda, 0xcc, 0x22,
|
||||||
0x7d, 0x66, 0x11, 0xb4, 0x76, 0xda, 0x36, 0x14, 0x0c, 0x23, 0xec, 0x8e,
|
0x68, 0xed, 0xb4, 0x5d, 0x28, 0x18, 0x46, 0xd8, 0x9d, 0xce, 0x58, 0x0e,
|
||||||
0x67, 0x2c, 0x07, 0x55, 0x93, 0x65, 0x9c, 0x06, 0x88, 0x60, 0x83, 0x9b,
|
0x8a, 0x26, 0xcb, 0x38, 0x0d, 0x10, 0xc1, 0x06, 0x37, 0x0f, 0xf7, 0x58,
|
||||||
0x87, 0x07, 0xac, 0xd8, 0xb1, 0xaa, 0xc4, 0x62, 0xd6, 0x01, 0xf7, 0x70,
|
0xb1, 0x53, 0x55, 0x89, 0xc5, 0xac, 0x03, 0xee, 0xe1, 0x1c, 0x6e, 0x55,
|
||||||
0x01, 0xd7, 0xaa, 0x03, 0xf0, 0x58, 0xd9, 0x4d, 0x67, 0xa0, 0x39, 0x34,
|
0x07, 0xe0, 0x91, 0xb2, 0x1b, 0xce, 0x40, 0x73, 0x68, 0x0c, 0x32, 0xeb,
|
||||||
0x06, 0x99, 0xf5, 0x4c, 0x84, 0xbd, 0x09, 0x9b, 0xc6, 0x92, 0x0a, 0x7b,
|
0x99, 0x08, 0x7b, 0x13, 0x36, 0x8d, 0x25, 0x15, 0xf6, 0x36, 0x4f, 0x01,
|
||||||
0x9d, 0xa7, 0x80, 0x7f, 0x87, 0xea, 0xa2, 0xc4, 0x85, 0xbc, 0x45, 0x07,
|
0xff, 0x01, 0xc5, 0x45, 0x89, 0x0b, 0x79, 0x8b, 0xf6, 0x5b, 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0d, 0x5d, 0xee, 0x41, 0xeb, 0xdb, 0xab, 0xb9, 0x70,
|
||||||
0x93, 0xe1, 0xfe, 0x03, 0x25, 0xf5, 0x13, 0xad, 0x78, 0x27, 0x55, 0x31,
|
0xef, 0x9e, 0x92, 0xfa, 0x85, 0x56, 0xbc, 0x93, 0xaa, 0x18, 0xd1, 0x8b,
|
||||||
0xe2, 0x17, 0xb7, 0xe5, 0x71, 0x43, 0xcb, 0x71, 0x75, 0x5b, 0x1e, 0xc7,
|
0xdb, 0xf2, 0xa8, 0xa1, 0xa5, 0xb8, 0xba, 0x2d, 0x8f, 0x63, 0xf2, 0x48,
|
||||||
0xe4, 0xb1, 0x9c, 0x55, 0x0c, 0xed, 0x17, 0x43, 0x89, 0xc6, 0x13, 0xc7,
|
0xce, 0x2a, 0x86, 0xf6, 0x83, 0xa1, 0x44, 0xe3, 0x81, 0x63, 0x7a, 0x63,
|
||||||
0xf4, 0xc6, 0xb0, 0xc7, 0x12, 0xd1, 0x42, 0xad, 0x63, 0x36, 0x55, 0x74,
|
0xd8, 0x43, 0x89, 0x68, 0xa1, 0xd6, 0x31, 0x9b, 0x2a, 0xba, 0x21, 0x08,
|
||||||
0x53, 0x10, 0xa4, 0xbc, 0x90, 0xc4, 0x7d, 0xbb, 0x77, 0x6c, 0x01, 0xe7,
|
0x52, 0x5e, 0x48, 0xe2, 0x3e, 0xdd, 0x3b, 0xb6, 0x80, 0x73, 0xba, 0x29,
|
||||||
0x74, 0x5b, 0x82, 0xa3, 0x8e, 0xc1, 0x06, 0x4e, 0x35, 0xa4, 0x1f, 0x20,
|
0xc1, 0x51, 0x47, 0x60, 0x03, 0xa7, 0x1a, 0xce, 0x0f, 0x10, 0x30, 0x4d,
|
||||||
0x60, 0x9a, 0x94, 0xe6, 0x92, 0x13, 0x4b, 0xff, 0x5f, 0x67, 0x03, 0xf2,
|
0x4a, 0x73, 0xc9, 0x89, 0x65, 0xff, 0xaf, 0xb3, 0x01, 0xf9, 0xd4, 0x59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, 0xf7, 0xff,
|
0xab, 0xef, 0x6e, 0x04, 0xb6, 0x93, 0xef, 0xf6, 0x19, 0xf4, 0x52, 0xf7,
|
||||||
0x90, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xcb, 0x0f, 0xda, 0x06, 0x98,
|
0xdf, 0x90, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x5e, 0xf2, 0x61, 0x32,
|
||||||
0x14, 0x00, 0x00,
|
0x97, 0x14, 0x00, 0x00,
|
||||||
},
|
},
|
||||||
"assets/templates/layout.html",
|
"assets/templates/layout.html",
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Asset loads and returns the asset for the given name.
|
// Asset loads and returns the asset for the given name.
|
||||||
// It returns an error if the asset could not be found or
|
// It returns an error if the asset could not be found or
|
||||||
// could not be loaded.
|
// could not be loaded.
|
||||||
|
@ -977,12 +976,11 @@ func Asset(name string) ([]byte, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// _bindata is a table, holding each asset generator, mapped to its name.
|
// _bindata is a table, holding each asset generator, mapped to its name.
|
||||||
var _bindata = map[string] func() ([]byte, error) {
|
var _bindata = map[string]func() ([]byte, error){
|
||||||
"assets/images/github.png": assets_images_github_png,
|
"assets/images/github.png": assets_images_github_png,
|
||||||
"assets/images/ajax-loader.gif": assets_images_ajax_loader_gif,
|
"assets/images/ajax-loader.gif": assets_images_ajax_loader_gif,
|
||||||
"assets/images/hog.png": assets_images_hog_png,
|
"assets/images/hog.png": assets_images_hog_png,
|
||||||
"assets/js/controllers.js": assets_js_controllers_js,
|
"assets/js/controllers.js": assets_js_controllers_js,
|
||||||
"assets/templates/index.html": assets_templates_index_html,
|
"assets/templates/index.html": assets_templates_index_html,
|
||||||
"assets/templates/layout.html": assets_templates_layout_html,
|
"assets/templates/layout.html": assets_templates_layout_html,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,21 +4,21 @@ func DefaultConfig() *Config {
|
||||||
return &Config{
|
return &Config{
|
||||||
SMTPBindAddr: "0.0.0.0:1025",
|
SMTPBindAddr: "0.0.0.0:1025",
|
||||||
HTTPBindAddr: "0.0.0.0:8025",
|
HTTPBindAddr: "0.0.0.0:8025",
|
||||||
Hostname: "mailhog.example",
|
Hostname: "mailhog.example",
|
||||||
MongoUri: "127.0.0.1:27017",
|
MongoUri: "127.0.0.1:27017",
|
||||||
MongoDb: "mailhog",
|
MongoDb: "mailhog",
|
||||||
MongoColl: "messages",
|
MongoColl: "messages",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
SMTPBindAddr string
|
SMTPBindAddr string
|
||||||
HTTPBindAddr string
|
HTTPBindAddr string
|
||||||
Hostname string
|
Hostname string
|
||||||
MongoUri string
|
MongoUri string
|
||||||
MongoDb string
|
MongoDb string
|
||||||
MongoColl string
|
MongoColl string
|
||||||
MessageChan chan interface{}
|
MessageChan chan interface{}
|
||||||
Storage interface{}
|
Storage interface{}
|
||||||
Assets func(asset string) ([]byte, error)
|
Assets func(asset string) ([]byte, error)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,41 +1,41 @@
|
||||||
package data;
|
package data
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"labix.org/v2/mgo/bson"
|
||||||
"log"
|
"log"
|
||||||
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"regexp"
|
|
||||||
"labix.org/v2/mgo/bson"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Messages []Message
|
type Messages []Message
|
||||||
|
|
||||||
type Message struct {
|
type Message struct {
|
||||||
Id string
|
Id string
|
||||||
From *Path
|
From *Path
|
||||||
To []*Path
|
To []*Path
|
||||||
Content *Content
|
Content *Content
|
||||||
Created time.Time
|
Created time.Time
|
||||||
MIME *MIMEBody // FIXME refactor to use Content.MIME
|
MIME *MIMEBody // FIXME refactor to use Content.MIME
|
||||||
}
|
}
|
||||||
|
|
||||||
type Path struct {
|
type Path struct {
|
||||||
Relays []string
|
Relays []string
|
||||||
Mailbox string
|
Mailbox string
|
||||||
Domain string
|
Domain string
|
||||||
Params string
|
Params string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Content struct {
|
type Content struct {
|
||||||
Headers map[string][]string
|
Headers map[string][]string
|
||||||
Body string
|
Body string
|
||||||
Size int
|
Size int
|
||||||
MIME *MIMEBody
|
MIME *MIMEBody
|
||||||
}
|
}
|
||||||
|
|
||||||
type SMTPMessage struct {
|
type SMTPMessage struct {
|
||||||
From string
|
From string
|
||||||
To []string
|
To []string
|
||||||
Data string
|
Data string
|
||||||
Helo string
|
Helo string
|
||||||
}
|
}
|
||||||
|
@ -52,9 +52,9 @@ func ParseSMTPMessage(m *SMTPMessage, hostname string) *Message {
|
||||||
arr = append(arr, PathFromString(path))
|
arr = append(arr, PathFromString(path))
|
||||||
}
|
}
|
||||||
msg := &Message{
|
msg := &Message{
|
||||||
Id: bson.NewObjectId().Hex(),
|
Id: bson.NewObjectId().Hex(),
|
||||||
From: PathFromString(m.From),
|
From: PathFromString(m.From),
|
||||||
To: arr,
|
To: arr,
|
||||||
Content: ContentFromString(m.Data),
|
Content: ContentFromString(m.Data),
|
||||||
Created: time.Now(),
|
Created: time.Now(),
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ func ParseSMTPMessage(m *SMTPMessage, hostname string) *Message {
|
||||||
log.Printf("Parsing MIME body")
|
log.Printf("Parsing MIME body")
|
||||||
msg.MIME = msg.Content.ParseMIMEBody()
|
msg.MIME = msg.Content.ParseMIMEBody()
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.Content.Headers["Message-ID"] = []string{msg.Id + "@" + hostname}
|
msg.Content.Headers["Message-ID"] = []string{msg.Id + "@" + hostname}
|
||||||
msg.Content.Headers["Received"] = []string{"from " + m.Helo + " by " + hostname + " (Go-MailHog)\r\n id " + msg.Id + "@" + hostname + "; " + time.Now().Format(time.RFC1123Z)}
|
msg.Content.Headers["Received"] = []string{"from " + m.Helo + " by " + hostname + " (Go-MailHog)\r\n id " + msg.Id + "@" + hostname + "; " + time.Now().Format(time.RFC1123Z)}
|
||||||
msg.Content.Headers["Return-Path"] = []string{"<" + m.From + ">"}
|
msg.Content.Headers["Return-Path"] = []string{"<" + m.From + ">"}
|
||||||
|
@ -72,7 +72,9 @@ func ParseSMTPMessage(m *SMTPMessage, hostname string) *Message {
|
||||||
|
|
||||||
func (content *Content) IsMIME() bool {
|
func (content *Content) IsMIME() bool {
|
||||||
header, ok := content.Headers["Content-Type"]
|
header, ok := content.Headers["Content-Type"]
|
||||||
if !ok { return false }
|
if !ok {
|
||||||
|
return false
|
||||||
|
}
|
||||||
return strings.HasPrefix(header[0], "multipart/")
|
return strings.HasPrefix(header[0], "multipart/")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,12 +83,12 @@ func (content *Content) ParseMIMEBody() *MIMEBody {
|
||||||
match := re.FindStringSubmatch(content.Headers["Content-Type"][0])
|
match := re.FindStringSubmatch(content.Headers["Content-Type"][0])
|
||||||
log.Printf("Got boundary: %s", match[1])
|
log.Printf("Got boundary: %s", match[1])
|
||||||
|
|
||||||
p := strings.Split(content.Body, "--" + match[1])
|
p := strings.Split(content.Body, "--"+match[1])
|
||||||
parts := make([]*Content, 0)
|
parts := make([]*Content, 0)
|
||||||
for m := range p {
|
for m := range p {
|
||||||
if len(p[m]) > 0 {
|
if len(p[m]) > 0 {
|
||||||
part := ContentFromString(strings.Trim(p[m], "\r\n"))
|
part := ContentFromString(strings.Trim(p[m], "\r\n"))
|
||||||
if(part.IsMIME()) {
|
if part.IsMIME() {
|
||||||
log.Printf("Parsing inner MIME body")
|
log.Printf("Parsing inner MIME body")
|
||||||
part.MIME = part.ParseMIMEBody()
|
part.MIME = part.ParseMIMEBody()
|
||||||
}
|
}
|
||||||
|
@ -102,14 +104,14 @@ func (content *Content) ParseMIMEBody() *MIMEBody {
|
||||||
func PathFromString(path string) *Path {
|
func PathFromString(path string) *Path {
|
||||||
relays := make([]string, 0)
|
relays := make([]string, 0)
|
||||||
email := path
|
email := path
|
||||||
if(strings.Contains(path, ":")) {
|
if strings.Contains(path, ":") {
|
||||||
x := strings.SplitN(path, ":", 2)
|
x := strings.SplitN(path, ":", 2)
|
||||||
r, e := x[0], x[1]
|
r, e := x[0], x[1]
|
||||||
email = e
|
email = e
|
||||||
relays = strings.Split(r, ",")
|
relays = strings.Split(r, ",")
|
||||||
}
|
}
|
||||||
mailbox, domain := "", ""
|
mailbox, domain := "", ""
|
||||||
if(strings.Contains(email, "@")) {
|
if strings.Contains(email, "@") {
|
||||||
x := strings.SplitN(email, "@", 2)
|
x := strings.SplitN(email, "@", 2)
|
||||||
mailbox, domain = x[0], x[1]
|
mailbox, domain = x[0], x[1]
|
||||||
} else {
|
} else {
|
||||||
|
@ -117,10 +119,10 @@ func PathFromString(path string) *Path {
|
||||||
}
|
}
|
||||||
|
|
||||||
return &Path{
|
return &Path{
|
||||||
Relays: relays,
|
Relays: relays,
|
||||||
Mailbox: mailbox,
|
Mailbox: mailbox,
|
||||||
Domain: domain,
|
Domain: domain,
|
||||||
Params: "", // FIXME?
|
Params: "", // FIXME?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,15 +149,15 @@ func ContentFromString(data string) *Content {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return &Content{
|
return &Content{
|
||||||
Size: len(data),
|
Size: len(data),
|
||||||
Headers: h,
|
Headers: h,
|
||||||
Body: body,
|
Body: body,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return &Content{
|
return &Content{
|
||||||
Size: len(data),
|
Size: len(data),
|
||||||
Headers: h,
|
Headers: h,
|
||||||
Body: x[0],
|
Body: x[0],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,42 +1,40 @@
|
||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"net/smtp"
|
|
||||||
"strconv"
|
|
||||||
"strings"
|
|
||||||
"github.com/ian-kent/Go-MailHog/mailhog/data"
|
|
||||||
"github.com/ian-kent/Go-MailHog/mailhog/config"
|
"github.com/ian-kent/Go-MailHog/mailhog/config"
|
||||||
|
"github.com/ian-kent/Go-MailHog/mailhog/data"
|
||||||
"github.com/ian-kent/Go-MailHog/mailhog/storage"
|
"github.com/ian-kent/Go-MailHog/mailhog/storage"
|
||||||
|
"github.com/ian-kent/go-log/log"
|
||||||
gotcha "github.com/ian-kent/gotcha/app"
|
gotcha "github.com/ian-kent/gotcha/app"
|
||||||
"github.com/ian-kent/gotcha/http"
|
"github.com/ian-kent/gotcha/http"
|
||||||
|
"net/smtp"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
type APIv1 struct {
|
type APIv1 struct {
|
||||||
config *config.Config
|
config *config.Config
|
||||||
eventlisteners []*EventListener
|
eventlisteners []*EventListener
|
||||||
app *gotcha.App
|
app *gotcha.App
|
||||||
}
|
}
|
||||||
|
|
||||||
type EventListener struct {
|
type EventListener struct {
|
||||||
session *http.Session
|
session *http.Session
|
||||||
ch chan []byte
|
ch chan []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReleaseConfig struct {
|
type ReleaseConfig struct {
|
||||||
Email string
|
Email string
|
||||||
Host string
|
Host string
|
||||||
Port string
|
Port string
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateAPIv1(conf *config.Config, app *gotcha.App) *APIv1 {
|
func CreateAPIv1(conf *config.Config, app *gotcha.App) *APIv1 {
|
||||||
log.Println("Creating API v1")
|
log.Println("Creating API v1")
|
||||||
apiv1 := &APIv1{
|
apiv1 := &APIv1{
|
||||||
config: conf,
|
config: conf,
|
||||||
eventlisteners: make([]*EventListener, 0),
|
eventlisteners: make([]*EventListener, 0),
|
||||||
app: app,
|
app: app,
|
||||||
}
|
}
|
||||||
|
|
||||||
r := app.Router
|
r := app.Router
|
||||||
|
@ -53,12 +51,12 @@ func CreateAPIv1(conf *config.Config, app *gotcha.App) *APIv1 {
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case msg := <- apiv1.config.MessageChan:
|
case msg := <-apiv1.config.MessageChan:
|
||||||
log.Println("Got message in APIv1 event stream")
|
log.Println("Got message in APIv1 event stream")
|
||||||
bytes, _ := json.MarshalIndent(msg, "", " ")
|
bytes, _ := json.MarshalIndent(msg, "", " ")
|
||||||
json := string(bytes)
|
json := string(bytes)
|
||||||
log.Printf("Sending content: %s\n", json)
|
log.Printf("Sending content: %s\n", json)
|
||||||
apiv1.broadcast(json)
|
apiv1.broadcast(json)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
@ -68,24 +66,10 @@ func CreateAPIv1(conf *config.Config, app *gotcha.App) *APIv1 {
|
||||||
|
|
||||||
func (apiv1 *APIv1) broadcast(json string) {
|
func (apiv1 *APIv1) broadcast(json string) {
|
||||||
log.Println("[APIv1] BROADCAST /api/v1/events")
|
log.Println("[APIv1] BROADCAST /api/v1/events")
|
||||||
|
b := []byte(json)
|
||||||
for _, l := range apiv1.eventlisteners {
|
for _, l := range apiv1.eventlisteners {
|
||||||
log.Printf("Sending to connection: %s\n", l.session.Request.RemoteAddr)
|
log.Printf("Sending to connection: %s\n", l.session.Request.RemoteAddr)
|
||||||
|
l.ch <- b
|
||||||
lines := strings.Split(json, "\n")
|
|
||||||
data := ""
|
|
||||||
for _, l := range lines {
|
|
||||||
data += "data: " + l + "\n"
|
|
||||||
}
|
|
||||||
data += "\n"
|
|
||||||
|
|
||||||
size := fmt.Sprintf("%X", len(data) + 1)
|
|
||||||
l.ch <- []byte(size + "\r\n")
|
|
||||||
|
|
||||||
lines = strings.Split(data, "\n")
|
|
||||||
for _, ln := range lines {
|
|
||||||
l.ch <- []byte(ln + "\n")
|
|
||||||
}
|
|
||||||
l.ch <- []byte("\r\n")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,18 +87,18 @@ func (apiv1 *APIv1) messages(session *http.Session) {
|
||||||
|
|
||||||
// TODO start, limit
|
// TODO start, limit
|
||||||
switch apiv1.config.Storage.(type) {
|
switch apiv1.config.Storage.(type) {
|
||||||
case *storage.MongoDB:
|
case *storage.MongoDB:
|
||||||
messages, _ := apiv1.config.Storage.(*storage.MongoDB).List(0, 1000)
|
messages, _ := apiv1.config.Storage.(*storage.MongoDB).List(0, 1000)
|
||||||
bytes, _ := json.Marshal(messages)
|
bytes, _ := json.Marshal(messages)
|
||||||
session.Response.Headers.Add("Content-Type", "text/json")
|
session.Response.Headers.Add("Content-Type", "text/json")
|
||||||
session.Response.Write(bytes)
|
session.Response.Write(bytes)
|
||||||
case *storage.Memory:
|
case *storage.Memory:
|
||||||
messages, _ := apiv1.config.Storage.(*storage.Memory).List(0, 1000)
|
messages, _ := apiv1.config.Storage.(*storage.Memory).List(0, 1000)
|
||||||
bytes, _ := json.Marshal(messages)
|
bytes, _ := json.Marshal(messages)
|
||||||
session.Response.Headers.Add("Content-Type", "text/json")
|
session.Response.Headers.Add("Content-Type", "text/json")
|
||||||
session.Response.Write(bytes)
|
session.Response.Write(bytes)
|
||||||
default:
|
default:
|
||||||
session.Response.Status = 500
|
session.Response.Status = 500
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,18 +107,18 @@ func (apiv1 *APIv1) message(session *http.Session) {
|
||||||
log.Printf("[APIv1] GET /api/v1/messages/%s\n", id)
|
log.Printf("[APIv1] GET /api/v1/messages/%s\n", id)
|
||||||
|
|
||||||
switch apiv1.config.Storage.(type) {
|
switch apiv1.config.Storage.(type) {
|
||||||
case *storage.MongoDB:
|
case *storage.MongoDB:
|
||||||
message, _ := apiv1.config.Storage.(*storage.MongoDB).Load(id)
|
message, _ := apiv1.config.Storage.(*storage.MongoDB).Load(id)
|
||||||
bytes, _ := json.Marshal(message)
|
bytes, _ := json.Marshal(message)
|
||||||
session.Response.Headers.Add("Content-Type", "text/json")
|
session.Response.Headers.Add("Content-Type", "text/json")
|
||||||
session.Response.Write(bytes)
|
session.Response.Write(bytes)
|
||||||
case *storage.Memory:
|
case *storage.Memory:
|
||||||
message, _ := apiv1.config.Storage.(*storage.Memory).Load(id)
|
message, _ := apiv1.config.Storage.(*storage.Memory).Load(id)
|
||||||
bytes, _ := json.Marshal(message)
|
bytes, _ := json.Marshal(message)
|
||||||
session.Response.Headers.Add("Content-Type", "text/json")
|
session.Response.Headers.Add("Content-Type", "text/json")
|
||||||
session.Response.Write(bytes)
|
session.Response.Write(bytes)
|
||||||
default:
|
default:
|
||||||
session.Response.Status = 500
|
session.Response.Status = 500
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,27 +127,27 @@ func (apiv1 *APIv1) download(session *http.Session) {
|
||||||
log.Printf("[APIv1] GET /api/v1/messages/%s\n", id)
|
log.Printf("[APIv1] GET /api/v1/messages/%s\n", id)
|
||||||
|
|
||||||
session.Response.Headers.Add("Content-Type", "message/rfc822")
|
session.Response.Headers.Add("Content-Type", "message/rfc822")
|
||||||
session.Response.Headers.Add("Content-Disposition", "attachment; filename=\"" + id + ".eml\"")
|
session.Response.Headers.Add("Content-Disposition", "attachment; filename=\""+id+".eml\"")
|
||||||
|
|
||||||
switch apiv1.config.Storage.(type) {
|
switch apiv1.config.Storage.(type) {
|
||||||
case *storage.MongoDB:
|
case *storage.MongoDB:
|
||||||
message, _ := apiv1.config.Storage.(*storage.MongoDB).Load(id)
|
message, _ := apiv1.config.Storage.(*storage.MongoDB).Load(id)
|
||||||
for h, l := range message.Content.Headers {
|
for h, l := range message.Content.Headers {
|
||||||
for _, v := range l {
|
for _, v := range l {
|
||||||
session.Response.Write([]byte(h + ": " + v + "\r\n"))
|
session.Response.Write([]byte(h + ": " + v + "\r\n"))
|
||||||
}
|
|
||||||
}
|
}
|
||||||
session.Response.Write([]byte("\r\n" + message.Content.Body))
|
}
|
||||||
case *storage.Memory:
|
session.Response.Write([]byte("\r\n" + message.Content.Body))
|
||||||
message, _ := apiv1.config.Storage.(*storage.Memory).Load(id)
|
case *storage.Memory:
|
||||||
for h, l := range message.Content.Headers {
|
message, _ := apiv1.config.Storage.(*storage.Memory).Load(id)
|
||||||
for _, v := range l {
|
for h, l := range message.Content.Headers {
|
||||||
session.Response.Write([]byte(h + ": " + v + "\r\n"))
|
for _, v := range l {
|
||||||
}
|
session.Response.Write([]byte(h + ": " + v + "\r\n"))
|
||||||
}
|
}
|
||||||
session.Response.Write([]byte("\r\n" + message.Content.Body))
|
}
|
||||||
default:
|
session.Response.Write([]byte("\r\n" + message.Content.Body))
|
||||||
session.Response.Status = 500
|
default:
|
||||||
|
session.Response.Status = 500
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,27 +158,27 @@ func (apiv1 *APIv1) download_part(session *http.Session) {
|
||||||
|
|
||||||
// TODO extension from content-type?
|
// TODO extension from content-type?
|
||||||
|
|
||||||
session.Response.Headers.Add("Content-Disposition", "attachment; filename=\"" + id + "-part-" + strconv.Itoa(part) + "\"")
|
session.Response.Headers.Add("Content-Disposition", "attachment; filename=\""+id+"-part-"+strconv.Itoa(part)+"\"")
|
||||||
|
|
||||||
switch apiv1.config.Storage.(type) {
|
switch apiv1.config.Storage.(type) {
|
||||||
case *storage.MongoDB:
|
case *storage.MongoDB:
|
||||||
message, _ := apiv1.config.Storage.(*storage.MongoDB).Load(id)
|
message, _ := apiv1.config.Storage.(*storage.MongoDB).Load(id)
|
||||||
for h, l := range message.MIME.Parts[part].Headers {
|
for h, l := range message.MIME.Parts[part].Headers {
|
||||||
for _, v := range l {
|
for _, v := range l {
|
||||||
session.Response.Headers.Add(h, v)
|
session.Response.Headers.Add(h, v)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
session.Response.Write([]byte("\r\n" + message.MIME.Parts[part].Body))
|
}
|
||||||
case *storage.Memory:
|
session.Response.Write([]byte("\r\n" + message.MIME.Parts[part].Body))
|
||||||
message, _ := apiv1.config.Storage.(*storage.Memory).Load(id)
|
case *storage.Memory:
|
||||||
for h, l := range message.MIME.Parts[part].Headers {
|
message, _ := apiv1.config.Storage.(*storage.Memory).Load(id)
|
||||||
for _, v := range l {
|
for h, l := range message.MIME.Parts[part].Headers {
|
||||||
session.Response.Headers.Add(h, v)
|
for _, v := range l {
|
||||||
}
|
session.Response.Headers.Add(h, v)
|
||||||
}
|
}
|
||||||
session.Response.Write([]byte("\r\n" + message.MIME.Parts[part].Body))
|
}
|
||||||
default:
|
session.Response.Write([]byte("\r\n" + message.MIME.Parts[part].Body))
|
||||||
session.Response.Status = 500
|
default:
|
||||||
|
session.Response.Status = 500
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,13 +187,13 @@ func (apiv1 *APIv1) delete_all(session *http.Session) {
|
||||||
|
|
||||||
session.Response.Headers.Add("Content-Type", "text/json")
|
session.Response.Headers.Add("Content-Type", "text/json")
|
||||||
switch apiv1.config.Storage.(type) {
|
switch apiv1.config.Storage.(type) {
|
||||||
case *storage.MongoDB:
|
case *storage.MongoDB:
|
||||||
apiv1.config.Storage.(*storage.MongoDB).DeleteAll()
|
apiv1.config.Storage.(*storage.MongoDB).DeleteAll()
|
||||||
case *storage.Memory:
|
case *storage.Memory:
|
||||||
apiv1.config.Storage.(*storage.Memory).DeleteAll()
|
apiv1.config.Storage.(*storage.Memory).DeleteAll()
|
||||||
default:
|
default:
|
||||||
session.Response.Status = 500
|
session.Response.Status = 500
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,13 +204,13 @@ func (apiv1 *APIv1) release_one(session *http.Session) {
|
||||||
session.Response.Headers.Add("Content-Type", "text/json")
|
session.Response.Headers.Add("Content-Type", "text/json")
|
||||||
var msg = &data.Message{}
|
var msg = &data.Message{}
|
||||||
switch apiv1.config.Storage.(type) {
|
switch apiv1.config.Storage.(type) {
|
||||||
case *storage.MongoDB:
|
case *storage.MongoDB:
|
||||||
msg, _ = apiv1.config.Storage.(*storage.MongoDB).Load(id)
|
msg, _ = apiv1.config.Storage.(*storage.MongoDB).Load(id)
|
||||||
case *storage.Memory:
|
case *storage.Memory:
|
||||||
msg, _ = apiv1.config.Storage.(*storage.Memory).Load(id)
|
msg, _ = apiv1.config.Storage.(*storage.Memory).Load(id)
|
||||||
default:
|
default:
|
||||||
session.Response.Status = 500
|
session.Response.Status = 500
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
decoder := json.NewDecoder(session.Request.Body())
|
decoder := json.NewDecoder(session.Request.Body())
|
||||||
|
@ -245,12 +229,12 @@ func (apiv1 *APIv1) release_one(session *http.Session) {
|
||||||
bytes := make([]byte, 0)
|
bytes := make([]byte, 0)
|
||||||
for h, l := range msg.Content.Headers {
|
for h, l := range msg.Content.Headers {
|
||||||
for _, v := range l {
|
for _, v := range l {
|
||||||
bytes = append(bytes, []byte(h + ": " + v + "\r\n")...)
|
bytes = append(bytes, []byte(h+": "+v+"\r\n")...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bytes = append(bytes, []byte("\r\n" + msg.Content.Body)...)
|
bytes = append(bytes, []byte("\r\n"+msg.Content.Body)...)
|
||||||
|
|
||||||
err = smtp.SendMail(cfg.Host + ":" + cfg.Port, nil, "nobody@" + apiv1.config.Hostname, []string{cfg.Email}, bytes)
|
err = smtp.SendMail(cfg.Host+":"+cfg.Port, nil, "nobody@"+apiv1.config.Hostname, []string{cfg.Email}, bytes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to release message: %s", err)
|
log.Printf("Failed to release message: %s", err)
|
||||||
session.Response.Status = 500
|
session.Response.Status = 500
|
||||||
|
@ -265,11 +249,11 @@ func (apiv1 *APIv1) delete_one(session *http.Session) {
|
||||||
|
|
||||||
session.Response.Headers.Add("Content-Type", "text/json")
|
session.Response.Headers.Add("Content-Type", "text/json")
|
||||||
switch apiv1.config.Storage.(type) {
|
switch apiv1.config.Storage.(type) {
|
||||||
case *storage.MongoDB:
|
case *storage.MongoDB:
|
||||||
apiv1.config.Storage.(*storage.MongoDB).DeleteOne(id)
|
apiv1.config.Storage.(*storage.MongoDB).DeleteOne(id)
|
||||||
case *storage.Memory:
|
case *storage.Memory:
|
||||||
apiv1.config.Storage.(*storage.Memory).DeleteOne(id)
|
apiv1.config.Storage.(*storage.Memory).DeleteOne(id)
|
||||||
default:
|
default:
|
||||||
session.Response.Status = 500
|
session.Response.Status = 500
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,23 +3,23 @@ package smtp
|
||||||
// http://www.rfc-editor.org/rfc/rfc5321.txt
|
// http://www.rfc-editor.org/rfc/rfc5321.txt
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
|
||||||
"net"
|
|
||||||
"strings"
|
|
||||||
"regexp"
|
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/ian-kent/Go-MailHog/mailhog/config"
|
"github.com/ian-kent/Go-MailHog/mailhog/config"
|
||||||
"github.com/ian-kent/Go-MailHog/mailhog/storage"
|
|
||||||
"github.com/ian-kent/Go-MailHog/mailhog/data"
|
"github.com/ian-kent/Go-MailHog/mailhog/data"
|
||||||
|
"github.com/ian-kent/Go-MailHog/mailhog/storage"
|
||||||
|
"log"
|
||||||
|
"net"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Session struct {
|
type Session struct {
|
||||||
conn *net.TCPConn
|
conn *net.TCPConn
|
||||||
line string
|
line string
|
||||||
conf *config.Config
|
conf *config.Config
|
||||||
state int
|
state int
|
||||||
message *data.SMTPMessage
|
message *data.SMTPMessage
|
||||||
isTLS bool
|
isTLS bool
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -37,7 +37,7 @@ const (
|
||||||
func StartSession(conn *net.TCPConn, conf *config.Config) {
|
func StartSession(conn *net.TCPConn, conf *config.Config) {
|
||||||
conv := &Session{conn, "", conf, ESTABLISH, &data.SMTPMessage{}, false}
|
conv := &Session{conn, "", conf, ESTABLISH, &data.SMTPMessage{}, false}
|
||||||
conv.log("Starting session")
|
conv.log("Starting session")
|
||||||
conv.Write("220", conv.conf.Hostname + " ESMTP Go-MailHog")
|
conv.Write("220", conv.conf.Hostname+" ESMTP Go-MailHog")
|
||||||
conv.Read()
|
conv.Read()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ func (c *Session) Parse() {
|
||||||
}
|
}
|
||||||
if c.state == DATA {
|
if c.state == DATA {
|
||||||
c.message.Data += parts[0] + "\n"
|
c.message.Data += parts[0] + "\n"
|
||||||
if(strings.HasSuffix(c.message.Data, "\r\n.\r\n")) {
|
if strings.HasSuffix(c.message.Data, "\r\n.\r\n") {
|
||||||
c.log("Got EOF, storing message and switching to MAIL state")
|
c.log("Got EOF, storing message and switching to MAIL state")
|
||||||
//c.log("Full message data: %s", c.message.Data)
|
//c.log("Full message data: %s", c.message.Data)
|
||||||
c.message.Data = strings.TrimSuffix(c.message.Data, "\r\n.\r\n")
|
c.message.Data = strings.TrimSuffix(c.message.Data, "\r\n.\r\n")
|
||||||
|
@ -86,15 +86,15 @@ func (c *Session) Parse() {
|
||||||
var id string
|
var id string
|
||||||
var err error
|
var err error
|
||||||
switch c.conf.Storage.(type) {
|
switch c.conf.Storage.(type) {
|
||||||
case *storage.MongoDB:
|
case *storage.MongoDB:
|
||||||
c.log("Storing message using MongoDB")
|
c.log("Storing message using MongoDB")
|
||||||
id, err = c.conf.Storage.(*storage.MongoDB).Store(msg)
|
id, err = c.conf.Storage.(*storage.MongoDB).Store(msg)
|
||||||
case *storage.Memory:
|
case *storage.Memory:
|
||||||
c.log("Storing message using Memory")
|
c.log("Storing message using Memory")
|
||||||
id, err = c.conf.Storage.(*storage.Memory).Store(msg)
|
id, err = c.conf.Storage.(*storage.Memory).Store(msg)
|
||||||
default:
|
default:
|
||||||
c.log("Unknown storage type")
|
c.log("Unknown storage type")
|
||||||
// TODO send error reply
|
// TODO send error reply
|
||||||
}
|
}
|
||||||
c.state = MAIL
|
c.state = MAIL
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -102,7 +102,7 @@ func (c *Session) Parse() {
|
||||||
c.Write("452", "Unable to store message")
|
c.Write("452", "Unable to store message")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
c.Write("250", "Ok: queued as " + id)
|
c.Write("250", "Ok: queued as "+id)
|
||||||
c.conf.MessageChan <- msg
|
c.conf.MessageChan <- msg
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -115,15 +115,15 @@ func (c *Session) Parse() {
|
||||||
|
|
||||||
func (c *Session) Write(code string, text ...string) {
|
func (c *Session) Write(code string, text ...string) {
|
||||||
if len(text) == 1 {
|
if len(text) == 1 {
|
||||||
c.log("Sent %d bytes: '%s'", len(text[0] + "\n"), text[0] + "\n")
|
c.log("Sent %d bytes: '%s'", len(text[0]+"\n"), text[0]+"\n")
|
||||||
c.conn.Write([]byte(code + " " + text[0] + "\n"))
|
c.conn.Write([]byte(code + " " + text[0] + "\n"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for i := 0; i < len(text) - 1; i++ {
|
for i := 0; i < len(text)-1; i++ {
|
||||||
c.log("Sent %d bytes: '%s'", len(text[i] + "\n"), text[i] + "\n")
|
c.log("Sent %d bytes: '%s'", len(text[i]+"\n"), text[i]+"\n")
|
||||||
c.conn.Write([]byte(code + "-" + text[i] + "\n"))
|
c.conn.Write([]byte(code + "-" + text[i] + "\n"))
|
||||||
}
|
}
|
||||||
c.log("Sent %d bytes: '%s'", len(text[len(text)-1] + "\n"), text[len(text)-1] + "\n")
|
c.log("Sent %d bytes: '%s'", len(text[len(text)-1]+"\n"), text[len(text)-1]+"\n")
|
||||||
c.conn.Write([]byte(code + " " + text[len(text)-1] + "\n"))
|
c.conn.Write([]byte(code + " " + text[len(text)-1] + "\n"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,122 +136,122 @@ func (c *Session) Process(line string) {
|
||||||
c.log("In state %d, got command '%s', args '%s'", c.state, command, args)
|
c.log("In state %d, got command '%s', args '%s'", c.state, command, args)
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case command == "RSET":
|
case command == "RSET":
|
||||||
c.log("Got RSET command, switching to ESTABLISH state")
|
c.log("Got RSET command, switching to ESTABLISH state")
|
||||||
c.state = ESTABLISH
|
c.state = ESTABLISH
|
||||||
c.message = &data.SMTPMessage{}
|
c.message = &data.SMTPMessage{}
|
||||||
c.Write("250", "Ok")
|
c.Write("250", "Ok")
|
||||||
case command == "NOOP":
|
case command == "NOOP":
|
||||||
c.log("Got NOOP command")
|
c.log("Got NOOP command")
|
||||||
c.Write("250", "Ok")
|
c.Write("250", "Ok")
|
||||||
case command == "QUIT":
|
case command == "QUIT":
|
||||||
c.log("Got QUIT command")
|
c.log("Got QUIT command")
|
||||||
c.Write("221", "Bye")
|
c.Write("221", "Bye")
|
||||||
err := c.conn.Close()
|
err := c.conn.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.log("Error closing connection")
|
c.log("Error closing connection")
|
||||||
}
|
}
|
||||||
case c.state == ESTABLISH:
|
case c.state == ESTABLISH:
|
||||||
switch command {
|
switch command {
|
||||||
case "HELO":
|
case "HELO":
|
||||||
c.log("Got HELO command, switching to MAIL state")
|
c.log("Got HELO command, switching to MAIL state")
|
||||||
c.state = MAIL
|
|
||||||
c.message.Helo = args
|
|
||||||
c.Write("250", "Hello " + args)
|
|
||||||
case "EHLO":
|
|
||||||
c.log("Got EHLO command, switching to MAIL state")
|
|
||||||
c.state = MAIL
|
|
||||||
c.message.Helo = args
|
|
||||||
c.Write("250", "Hello " + args, "PIPELINING", "AUTH EXTERNAL CRAM-MD5 LOGIN PLAIN")
|
|
||||||
default:
|
|
||||||
c.log("Got unknown command for ESTABLISH state: '%s'", command)
|
|
||||||
c.Write("500", "Unrecognised command")
|
|
||||||
}
|
|
||||||
case c.state == AUTH:
|
|
||||||
c.log("Got authentication response: '%s', switching to MAIL state", args)
|
|
||||||
c.state = MAIL
|
c.state = MAIL
|
||||||
c.Write("235", "Authentication successful")
|
c.message.Helo = args
|
||||||
case c.state == AUTH2:
|
c.Write("250", "Hello "+args)
|
||||||
c.log("Got LOGIN authentication response: '%s', switching to AUTH state", args)
|
case "EHLO":
|
||||||
c.state = AUTH
|
c.log("Got EHLO command, switching to MAIL state")
|
||||||
c.Write("334", "UGFzc3dvcmQ6")
|
c.state = MAIL
|
||||||
case c.state == MAIL: // TODO rename/split state
|
c.message.Helo = args
|
||||||
switch command {
|
c.Write("250", "Hello "+args, "PIPELINING", "AUTH EXTERNAL CRAM-MD5 LOGIN PLAIN")
|
||||||
case "AUTH":
|
default:
|
||||||
c.log("Got AUTH command, staying in MAIL state")
|
c.log("Got unknown command for ESTABLISH state: '%s'", command)
|
||||||
switch {
|
c.Write("500", "Unrecognised command")
|
||||||
case strings.HasPrefix(args, "PLAIN "):
|
}
|
||||||
c.log("Got PLAIN authentication: %s", strings.TrimPrefix(args, "PLAIN "))
|
case c.state == AUTH:
|
||||||
c.Write("235", "Authentication successful")
|
c.log("Got authentication response: '%s', switching to MAIL state", args)
|
||||||
case args == "LOGIN":
|
c.state = MAIL
|
||||||
c.log("Got LOGIN authentication, switching to AUTH state")
|
c.Write("235", "Authentication successful")
|
||||||
c.state = AUTH2
|
case c.state == AUTH2:
|
||||||
c.Write("334", "VXNlcm5hbWU6")
|
c.log("Got LOGIN authentication response: '%s', switching to AUTH state", args)
|
||||||
case args == "PLAIN":
|
c.state = AUTH
|
||||||
c.log("Got PLAIN authentication (no args), switching to AUTH2 state")
|
c.Write("334", "UGFzc3dvcmQ6")
|
||||||
c.state = AUTH
|
case c.state == MAIL: // TODO rename/split state
|
||||||
c.Write("334", "")
|
switch command {
|
||||||
case args == "CRAM-MD5":
|
case "AUTH":
|
||||||
c.log("Got CRAM-MD5 authentication, switching to AUTH state")
|
c.log("Got AUTH command, staying in MAIL state")
|
||||||
c.state = AUTH
|
switch {
|
||||||
c.Write("334", "PDQxOTI5NDIzNDEuMTI4Mjg0NzJAc291cmNlZm91ci5hbmRyZXcuY211LmVkdT4=")
|
case strings.HasPrefix(args, "PLAIN "):
|
||||||
case strings.HasPrefix(args, "EXTERNAL "):
|
c.log("Got PLAIN authentication: %s", strings.TrimPrefix(args, "PLAIN "))
|
||||||
c.log("Got EXTERNAL authentication: %s", strings.TrimPrefix(args, "EXTERNAL "))
|
c.Write("235", "Authentication successful")
|
||||||
c.Write("235", "Authentication successful")
|
case args == "LOGIN":
|
||||||
default:
|
c.log("Got LOGIN authentication, switching to AUTH state")
|
||||||
c.Write("504", "Unsupported authentication mechanism")
|
c.state = AUTH2
|
||||||
}
|
c.Write("334", "VXNlcm5hbWU6")
|
||||||
case "MAIL":
|
case args == "PLAIN":
|
||||||
c.log("Got MAIL command, switching to RCPT state")
|
c.log("Got PLAIN authentication (no args), switching to AUTH2 state")
|
||||||
from, err := ParseMAIL(args)
|
c.state = AUTH
|
||||||
if err != nil {
|
c.Write("334", "")
|
||||||
c.Write("550", err.Error())
|
case args == "CRAM-MD5":
|
||||||
return
|
c.log("Got CRAM-MD5 authentication, switching to AUTH state")
|
||||||
}
|
c.state = AUTH
|
||||||
c.message.From = from
|
c.Write("334", "PDQxOTI5NDIzNDEuMTI4Mjg0NzJAc291cmNlZm91ci5hbmRyZXcuY211LmVkdT4=")
|
||||||
c.state = RCPT
|
case strings.HasPrefix(args, "EXTERNAL "):
|
||||||
c.Write("250", "Sender " + from + " ok")
|
c.log("Got EXTERNAL authentication: %s", strings.TrimPrefix(args, "EXTERNAL "))
|
||||||
default:
|
c.Write("235", "Authentication successful")
|
||||||
c.log("Got unknown command for MAIL state: '%s'", command)
|
default:
|
||||||
c.Write("500", "Unrecognised command")
|
c.Write("504", "Unsupported authentication mechanism")
|
||||||
}
|
}
|
||||||
case c.state == RCPT:
|
case "MAIL":
|
||||||
switch command {
|
c.log("Got MAIL command, switching to RCPT state")
|
||||||
case "RCPT":
|
from, err := ParseMAIL(args)
|
||||||
c.log("Got RCPT command")
|
if err != nil {
|
||||||
to, err := ParseRCPT(args)
|
c.Write("550", err.Error())
|
||||||
if err != nil {
|
return
|
||||||
c.Write("550", err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
c.message.To = append(c.message.To, to)
|
|
||||||
c.state = RCPT
|
|
||||||
c.Write("250", "Recipient " + to + " ok")
|
|
||||||
case "DATA":
|
|
||||||
c.log("Got DATA command, switching to DATA state")
|
|
||||||
c.state = DATA
|
|
||||||
c.Write("354", "End data with <CR><LF>.<CR><LF>")
|
|
||||||
default:
|
|
||||||
c.log("Got unknown command for RCPT state: '%s'", command)
|
|
||||||
c.Write("500", "Unrecognised command")
|
|
||||||
}
|
}
|
||||||
|
c.message.From = from
|
||||||
|
c.state = RCPT
|
||||||
|
c.Write("250", "Sender "+from+" ok")
|
||||||
|
default:
|
||||||
|
c.log("Got unknown command for MAIL state: '%s'", command)
|
||||||
|
c.Write("500", "Unrecognised command")
|
||||||
|
}
|
||||||
|
case c.state == RCPT:
|
||||||
|
switch command {
|
||||||
|
case "RCPT":
|
||||||
|
c.log("Got RCPT command")
|
||||||
|
to, err := ParseRCPT(args)
|
||||||
|
if err != nil {
|
||||||
|
c.Write("550", err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.message.To = append(c.message.To, to)
|
||||||
|
c.state = RCPT
|
||||||
|
c.Write("250", "Recipient "+to+" ok")
|
||||||
|
case "DATA":
|
||||||
|
c.log("Got DATA command, switching to DATA state")
|
||||||
|
c.state = DATA
|
||||||
|
c.Write("354", "End data with <CR><LF>.<CR><LF>")
|
||||||
|
default:
|
||||||
|
c.log("Got unknown command for RCPT state: '%s'", command)
|
||||||
|
c.Write("500", "Unrecognised command")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseMAIL(mail string) (string, error) {
|
func ParseMAIL(mail string) (string, error) {
|
||||||
r := regexp.MustCompile("(?i:From):<([^>]+)>")
|
r := regexp.MustCompile("(?i:From):<([^>]+)>")
|
||||||
match := r.FindStringSubmatch(mail)
|
match := r.FindStringSubmatch(mail)
|
||||||
if(len(match) != 2) {
|
if len(match) != 2 {
|
||||||
return "", errors.New("Invalid sender")
|
return "", errors.New("Invalid sender")
|
||||||
}
|
}
|
||||||
return match[1], nil;
|
return match[1], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func ParseRCPT(rcpt string) (string, error) {
|
func ParseRCPT(rcpt string) (string, error) {
|
||||||
r := regexp.MustCompile("(?i:To):<([^>]+)>")
|
r := regexp.MustCompile("(?i:To):<([^>]+)>")
|
||||||
match := r.FindStringSubmatch(rcpt)
|
match := r.FindStringSubmatch(rcpt)
|
||||||
if(len(match) != 2) {
|
if len(match) != 2 {
|
||||||
return "", errors.New("Invalid recipient")
|
return "", errors.New("Invalid recipient")
|
||||||
}
|
}
|
||||||
return match[1], nil;
|
return match[1], nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,21 +2,21 @@ package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/ian-kent/Go-MailHog/mailhog/config"
|
"github.com/ian-kent/Go-MailHog/mailhog/config"
|
||||||
"github.com/ian-kent/Go-MailHog/mailhog/data"
|
"github.com/ian-kent/Go-MailHog/mailhog/data"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Memory struct {
|
type Memory struct {
|
||||||
Config *config.Config
|
Config *config.Config
|
||||||
Messages map[string]*data.Message
|
Messages map[string]*data.Message
|
||||||
MessageIndex []string
|
MessageIndex []string
|
||||||
MessageRIndex map[string]int
|
MessageRIndex map[string]int
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateMemory(c *config.Config) *Memory {
|
func CreateMemory(c *config.Config) *Memory {
|
||||||
return &Memory{
|
return &Memory{
|
||||||
Config: c,
|
Config: c,
|
||||||
Messages: make(map[string]*data.Message, 0),
|
Messages: make(map[string]*data.Message, 0),
|
||||||
MessageIndex: make([]string, 0),
|
MessageIndex: make([]string, 0),
|
||||||
MessageRIndex: make(map[string]int, 0),
|
MessageRIndex: make(map[string]int, 0),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,21 +24,23 @@ func CreateMemory(c *config.Config) *Memory {
|
||||||
func (memory *Memory) Store(m *data.Message) (string, error) {
|
func (memory *Memory) Store(m *data.Message) (string, error) {
|
||||||
memory.Messages[m.Id] = m
|
memory.Messages[m.Id] = m
|
||||||
memory.MessageIndex = append(memory.MessageIndex, m.Id)
|
memory.MessageIndex = append(memory.MessageIndex, m.Id)
|
||||||
memory.MessageRIndex[m.Id] = len(memory.MessageIndex)
|
memory.MessageRIndex[m.Id] = len(memory.MessageIndex) - 1
|
||||||
return m.Id, nil
|
return m.Id, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (memory *Memory) List(start int, limit int) ([]*data.Message, error) {
|
func (memory *Memory) List(start int, limit int) ([]*data.Message, error) {
|
||||||
if limit > len(memory.MessageIndex) { limit = len(memory.MessageIndex) }
|
if limit > len(memory.MessageIndex) {
|
||||||
|
limit = len(memory.MessageIndex)
|
||||||
|
}
|
||||||
messages := make([]*data.Message, 0)
|
messages := make([]*data.Message, 0)
|
||||||
for _, m := range memory.MessageIndex[start:limit] {
|
for _, m := range memory.MessageIndex[start:limit] {
|
||||||
messages = append(messages, memory.Messages[m])
|
messages = append(messages, memory.Messages[m])
|
||||||
}
|
}
|
||||||
return messages, nil;
|
return messages, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (memory *Memory) DeleteOne(id string) error {
|
func (memory *Memory) DeleteOne(id string) error {
|
||||||
index := memory.MessageRIndex[id];
|
index := memory.MessageRIndex[id]
|
||||||
delete(memory.Messages, id)
|
delete(memory.Messages, id)
|
||||||
memory.MessageIndex = append(memory.MessageIndex[:index], memory.MessageIndex[index+1:]...)
|
memory.MessageIndex = append(memory.MessageIndex[:index], memory.MessageIndex[index+1:]...)
|
||||||
delete(memory.MessageRIndex, id)
|
delete(memory.MessageRIndex, id)
|
||||||
|
@ -53,5 +55,5 @@ func (memory *Memory) DeleteAll() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (memory *Memory) Load(id string) (*data.Message, error) {
|
func (memory *Memory) Load(id string) (*data.Message, error) {
|
||||||
return memory.Messages[id], nil;
|
return memory.Messages[id], nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,34 +1,34 @@
|
||||||
package storage
|
package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"github.com/ian-kent/Go-MailHog/mailhog/config"
|
||||||
|
"github.com/ian-kent/Go-MailHog/mailhog/data"
|
||||||
"labix.org/v2/mgo"
|
"labix.org/v2/mgo"
|
||||||
"labix.org/v2/mgo/bson"
|
"labix.org/v2/mgo/bson"
|
||||||
"github.com/ian-kent/Go-MailHog/mailhog/data"
|
"log"
|
||||||
"github.com/ian-kent/Go-MailHog/mailhog/config"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type MongoDB struct {
|
type MongoDB struct {
|
||||||
Session *mgo.Session
|
Session *mgo.Session
|
||||||
Config *config.Config
|
Config *config.Config
|
||||||
Collection *mgo.Collection
|
Collection *mgo.Collection
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateMongoDB(c *config.Config) *MongoDB {
|
func CreateMongoDB(c *config.Config) *MongoDB {
|
||||||
log.Printf("Connecting to MongoDB: %s\n", c.MongoUri)
|
log.Printf("Connecting to MongoDB: %s\n", c.MongoUri)
|
||||||
session, err := mgo.Dial(c.MongoUri)
|
session, err := mgo.Dial(c.MongoUri)
|
||||||
if(err != nil) {
|
if err != nil {
|
||||||
log.Printf("Error connecting to MongoDB: %s", err)
|
log.Printf("Error connecting to MongoDB: %s", err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return &MongoDB{
|
return &MongoDB{
|
||||||
Session: session,
|
Session: session,
|
||||||
Config: c,
|
Config: c,
|
||||||
Collection: session.DB(c.MongoDb).C(c.MongoColl),
|
Collection: session.DB(c.MongoDb).C(c.MongoColl),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mongo *MongoDB) Store(m *data.Message) (string, error) {
|
func (mongo *MongoDB) Store(m *data.Message) (string, error) {
|
||||||
err := mongo.Collection.Insert(m)
|
err := mongo.Collection.Insert(m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error inserting message: %s", err)
|
log.Printf("Error inserting message: %s", err)
|
||||||
|
@ -40,19 +40,19 @@ func (mongo *MongoDB) Store(m *data.Message) (string, error) {
|
||||||
func (mongo *MongoDB) List(start int, limit int) (*data.Messages, error) {
|
func (mongo *MongoDB) List(start int, limit int) (*data.Messages, error) {
|
||||||
messages := &data.Messages{}
|
messages := &data.Messages{}
|
||||||
err := mongo.Collection.Find(bson.M{}).Skip(start).Limit(limit).Select(bson.M{
|
err := mongo.Collection.Find(bson.M{}).Skip(start).Limit(limit).Select(bson.M{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"_id": 1,
|
"_id": 1,
|
||||||
"from": 1,
|
"from": 1,
|
||||||
"to": 1,
|
"to": 1,
|
||||||
"content.headers": 1,
|
"content.headers": 1,
|
||||||
"content.size": 1,
|
"content.size": 1,
|
||||||
"created": 1,
|
"created": 1,
|
||||||
}).All(messages)
|
}).All(messages)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Error loading messages: %s", err)
|
log.Printf("Error loading messages: %s", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return messages, nil;
|
return messages, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mongo *MongoDB) DeleteOne(id string) error {
|
func (mongo *MongoDB) DeleteOne(id string) error {
|
||||||
|
@ -72,5 +72,5 @@ func (mongo *MongoDB) Load(id string) (*data.Message, error) {
|
||||||
log.Printf("Error loading message: %s", err)
|
log.Printf("Error loading message: %s", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return result, nil;
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
25
main.go
25
main.go
|
@ -3,14 +3,16 @@ package main
|
||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
"github.com/ian-kent/Go-MailHog/mailhog/config"
|
"github.com/ian-kent/Go-MailHog/mailhog/config"
|
||||||
"github.com/ian-kent/Go-MailHog/mailhog/smtp"
|
mhhttp "github.com/ian-kent/Go-MailHog/mailhog/http"
|
||||||
"github.com/ian-kent/Go-MailHog/mailhog/http/api"
|
"github.com/ian-kent/Go-MailHog/mailhog/http/api"
|
||||||
|
"github.com/ian-kent/Go-MailHog/mailhog/smtp"
|
||||||
"github.com/ian-kent/Go-MailHog/mailhog/storage"
|
"github.com/ian-kent/Go-MailHog/mailhog/storage"
|
||||||
gotcha "github.com/ian-kent/gotcha/app"
|
|
||||||
"github.com/ian-kent/go-log/log"
|
"github.com/ian-kent/go-log/log"
|
||||||
|
gotcha "github.com/ian-kent/gotcha/app"
|
||||||
|
"github.com/ian-kent/gotcha/events"
|
||||||
|
"github.com/ian-kent/gotcha/http"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
mhhttp "github.com/ian-kent/Go-MailHog/mailhog/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var conf *config.Config
|
var conf *config.Config
|
||||||
|
@ -67,9 +69,9 @@ func main() {
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-exitCh:
|
case <-exitCh:
|
||||||
log.Printf("Received exit signal")
|
log.Printf("Received exit signal")
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,6 +82,11 @@ func web_listen() {
|
||||||
var app = gotcha.Create(Asset)
|
var app = gotcha.Create(Asset)
|
||||||
app.Config.Listen = conf.HTTPBindAddr
|
app.Config.Listen = conf.HTTPBindAddr
|
||||||
|
|
||||||
|
app.On(events.BeforeHandler, func(session *http.Session, next func()) {
|
||||||
|
session.Stash["config"] = conf
|
||||||
|
next()
|
||||||
|
})
|
||||||
|
|
||||||
r := app.Router
|
r := app.Router
|
||||||
|
|
||||||
r.Get("/images/(?P<file>.*)", r.Static("assets/images/{{file}}"))
|
r.Get("/images/(?P<file>.*)", r.Static("assets/images/{{file}}"))
|
||||||
|
@ -88,13 +95,13 @@ func web_listen() {
|
||||||
|
|
||||||
api.CreateAPIv1(conf, app)
|
api.CreateAPIv1(conf, app)
|
||||||
|
|
||||||
app.Config.LeftDelim = ">>";
|
app.Config.LeftDelim = "[:"
|
||||||
app.Config.RightDelim = "<<";
|
app.Config.RightDelim = ":]"
|
||||||
|
|
||||||
app.Start()
|
app.Start()
|
||||||
|
|
||||||
<-make(chan int)
|
<-make(chan int)
|
||||||
exitCh<-1
|
exitCh <- 1
|
||||||
}
|
}
|
||||||
|
|
||||||
func smtp_listen() *net.TCPListener {
|
func smtp_listen() *net.TCPListener {
|
||||||
|
|
Loading…
Reference in a new issue