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