Documentation ¶
Index ¶
- func Encrypt_Password(password string, salt []byte) string
- func MimeBodyDecode(str string, charset string, encoding string) string
- func MimeHeaderDecode(str string) string
- func ParseMIME(MIMEBody *MIMEBody, reader io.Reader, boundary string, message *Message) error
- func Partbuf(reader io.Reader) (int64, []byte, error)
- func Validate_Password(hashed string, input_password string) bool
- type Attachment
- type Content
- type DataStore
- type GreyHost
- type GreyMail
- type LoginForm
- type MIMEBody
- type MIMEPart
- type Message
- type Messages
- type MongoDB
- func (mongo *MongoDB) Close()
- func (mongo *MongoDB) DeleteAll() error
- func (mongo *MongoDB) DeleteOne(id string) error
- func (mongo *MongoDB) IsGreyHost(hostname string) (int, error)
- func (mongo *MongoDB) IsGreyMail(email, t string) (int, error)
- func (mongo *MongoDB) List(start int, limit int) (*Messages, error)
- func (mongo *MongoDB) Load(id string) (*Message, error)
- func (mongo *MongoDB) LoadAttachment(id string) (*Message, error)
- func (mongo *MongoDB) Login(username, password string) (*User, error)
- func (mongo *MongoDB) Store(m *Message) (string, error)
- func (mongo *MongoDB) StoreGreyHost(h *GreyHost) (string, error)
- func (mongo *MongoDB) StoreGreyMail(m *GreyMail) (string, error)
- func (mongo *MongoDB) StoreSpamIp(s SpamIP) (string, error)
- func (mongo *MongoDB) Total() (int, error)
- type Path
- type SpamIP
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Encrypt_Password ¶
func MimeHeaderDecode ¶
Decode strings in Mime header format eg. =?ISO-2022-JP?B?GyRCIVo9dztSOWJAOCVBJWMbKEI=?=
func Validate_Password ¶
Types ¶
type Attachment ¶
type Content ¶
type Content struct { Headers map[string][]string TextBody string HtmlBody string Size int Body string }
func ContentFromString ¶
type DataStore ¶
type DataStore struct { Config config.DataStoreConfig Storage interface{} SaveMailChan chan *config.SMTPMessage NotifyMailChan chan interface{} }
func (*DataStore) CheckGreyHost ¶
Check if host address is in greylist h -> hostname client ip
func (*DataStore) CheckGreyMail ¶
Check if email address is in greylist t -> type (from/to) m -> local mailbox d -> domain h -> client IP
func (*DataStore) SaveSpamIP ¶
func (*DataStore) StorageConnect ¶
func (ds *DataStore) StorageConnect()
func (*DataStore) StorageDisconnect ¶
func (ds *DataStore) StorageDisconnect()
type Message ¶
type Message struct { Id string Subject string From *Path To []*Path Created time.Time Attachments []*Attachment Ip string Content *Content MIME *MIMEBody Starred bool Unread bool }
func ParseSMTPMessage ¶
func ParseSMTPMessage(m *config.SMTPMessage, hostname string, mimeParser bool) *Message
TODO support nested MIME content
type MongoDB ¶
type MongoDB struct { Config config.DataStoreConfig Session *mgo.Session Messages *mgo.Collection Users *mgo.Collection Hosts *mgo.Collection Emails *mgo.Collection Spamdb *mgo.Collection }
func CreateMongoDB ¶
func CreateMongoDB(c config.DataStoreConfig) *MongoDB
type Path ¶
func PathFromString ¶
db.messages.find({ to:{ $elemMatch: { mailbox:"bob" } } }) db.messages.find( { 'from.mailbox': "alex" } )
type User ¶
type User struct { Id bson.ObjectId `bson:"_id"` Firstname string Lastname string Email string Username string Password string Avatar string Website string Location string Tagline string Bio string JoinedAt time.Time IsSuperuser bool IsActive bool ValidateCode string ResetCode string LastLoginTime time.Time LastLoginIp string LoginCount int64 }
func (*User) SetPassword ¶
SetPassword takes a plaintext password and hashes it with bcrypt and sets the password field to the hash.
Click to show internal directories.
Click to hide internal directories.