domain

package
v0.0.0-...-48d6722 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2020 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: GPL-3.0-or-later

SPDX-License-Identifier: GPL-3.0-or-later

Index

Constants

View Source
const (
	Checked     = MailClass(0)
	LearnedSpam = MailClass(10)
	LearnedHam  = MailClass(11)
)
View Source
const (
	LearnSpam = LearnType("spam")
	LearnHam  = LearnType("ham")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConcurrentSpamClassifier

type ConcurrentSpamClassifier interface {
	CheckAll(mails [][]byte, concurrency int) []*SpamResult
	LearnAll(learnType LearnType, mails [][]byte, concurrency int) []error
}

type ImapConnector

type ImapConnector interface {
	Select(folder string) (uint32, error)
	ListUids() ([]uint32, error)
	FetchMails(uids []uint32) ([]*RawImapMail, error)
	FetchIdHeaders(uids []uint32) ([]*ImapIdInfo, error)
	Put(body []byte, folder string) error
	DeleteReady() (error, error)
	Delete(uids []uint32) error
	MoveReady() (error, error)
	Move(uids []uint32, folder string) error

	Close() error
}

type ImapFolder

type ImapFolder struct {
	Name        string
	UidValidity uint32
}

type ImapIdInfo

type ImapIdInfo struct {
	Uid        uint32
	Subject    string
	MailIdHash string
}

type LearnType

type LearnType string

type MailClass

type MailClass int

type Persistence

type Persistence interface {
	Close() error
	AllFolders() ([]*ImapFolder, error)
	SaveFolder(name string, uidValidity uint32) error
	GetMailsInFolder(class MailClass, folder string) ([]*SavedImapMail, error)
	FindMailByHash(class MailClass, folder string, mailIdHash string) (*SavedImapMail, error)
	UpdateUid(id int64, uid uint32) error
	SaveMails(mails []SaveMail) error
}

type RawImapMail

type RawImapMail struct {
	Uid        uint32
	Subject    string
	MailIdHash string
	RawMail    []byte
}

type SaveMail

type SaveMail struct {
	Class      MailClass
	Uid        uint32
	MailIdHash string
	FolderName string
	Subject    string
	IsSpam     *bool
	Score      *float64
}

type SavedImapMail

type SavedImapMail struct {
	Id         int64
	Class      MailClass
	Uid        uint32
	MailIdHash string
	FolderName string
	Subject    string
	IsSpam     bool
	Score      float64
}

type SpamClassifier

type SpamClassifier interface {
	Check(rawMail []byte) *SpamResult
	Learn(learnType LearnType, rawMail []byte) error
}

type SpamResult

type SpamResult struct {
	IsSpam bool
	Score  float64
	Body   []byte
	Error  error
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL