Documentation ¶
Overview ¶
Administration of a postfixadmin database with ajax/rest
Index ¶
- Variables
- func AjaxAuth(resp http.ResponseWriter, req *http.Request) bool
- func AjaxHandlerAlias(resp http.ResponseWriter, req *http.Request)
- func AjaxHandlerAliases(resp http.ResponseWriter, req *http.Request)
- func AjaxHandlerDomain(resp http.ResponseWriter, req *http.Request)
- func AjaxHandlerDomainAll(resp http.ResponseWriter, req *http.Request)
- func AjaxHandlerDomainVirtual(resp http.ResponseWriter, req *http.Request)
- func AjaxHandlerDomains(resp http.ResponseWriter, req *http.Request)
- func AjaxHandlerMailbox(resp http.ResponseWriter, req *http.Request)
- func AjaxHandlerMailboxes(resp http.ResponseWriter, req *http.Request)
- func AjaxHandlerVacation(resp http.ResponseWriter, req *http.Request)
- func AjaxHandlerVacations(resp http.ResponseWriter, req *http.Request)
- func CreatePermissionErrPayload() string
- func DomainExists(domain string) bool
- func Initialize(conff *Config, db *sql.DB)
- func IsDomainValid(domain_name string) error
- func IsVacationAddress(address string) bool
- func MailboxExists(address string) bool
- func PassCrypt(raw_pass string, enc_pass string) (encrypted_pass string, err error)
- func SetupRoutes(router *mux.Router)
- func SplitEmail(email_str string) []string
- func UpdateVacationAlias(vac *Vacation)
- type Address
- type Alias
- type AliasPayload
- type AliasesPayload
- type Config
- type DbConf
- type Domain
- type DomainAllPayload
- type DomainPayload
- type DomainVirtualPayload
- type DomainsPayload
- type ErrPayload
- type Mailbox
- type MailboxPayload
- type MailboxVirtual
- type MailboxesPayload
- type Vacation
- type VacationNotification
- type VacationPayload
- type VacationsPayload
Constants ¶
This section is empty.
Variables ¶
var Dbo gorm.DB
Functions ¶
func AjaxHandlerAlias ¶
func AjaxHandlerAlias(resp http.ResponseWriter, req *http.Request)
/ajax/alias/<email>
func AjaxHandlerAliases ¶
func AjaxHandlerAliases(resp http.ResponseWriter, req *http.Request)
/ajax/domain/<domain>/aliases
func AjaxHandlerDomain ¶
func AjaxHandlerDomain(resp http.ResponseWriter, req *http.Request)
= /ajax/domain/{domain}
func AjaxHandlerDomainAll ¶
func AjaxHandlerDomainAll(resp http.ResponseWriter, req *http.Request)
/ajax/domain/{domain}/all
func AjaxHandlerDomainVirtual ¶
func AjaxHandlerDomainVirtual(resp http.ResponseWriter, req *http.Request)
/ajax/domain/{domain}/virtual
func AjaxHandlerDomains ¶
func AjaxHandlerDomains(resp http.ResponseWriter, req *http.Request)
Handles /ajax/domains
func AjaxHandlerMailbox ¶
func AjaxHandlerMailbox(resp http.ResponseWriter, req *http.Request)
/ajax/domain/<example.com>/mailbox/<email>
func AjaxHandlerMailboxes ¶
func AjaxHandlerMailboxes(resp http.ResponseWriter, req *http.Request)
/ajax/domain/<domain>/mailboxes
func AjaxHandlerVacation ¶
func AjaxHandlerVacation(resp http.ResponseWriter, req *http.Request)
Handles /ajax/vacation/<email>
func AjaxHandlerVacations ¶
func AjaxHandlerVacations(resp http.ResponseWriter, req *http.Request)
Handles /ajax/domain/<domain>/vacations
func CreatePermissionErrPayload ¶
func CreatePermissionErrPayload() string
func DomainExists ¶
func IsDomainValid ¶
func IsVacationAddress ¶
func MailboxExists ¶
func SetupRoutes ¶
Add routes for postfixadmin module. Idea is that if your not admin or alike, then u get a 404 or 500
func SplitEmail ¶
func UpdateVacationAlias ¶
func UpdateVacationAlias(vac *Vacation)
Types ¶
type Address ¶
type Address struct { Address string // foo@example.com User string // foo Domain string // example.com VacationAddress string // foo#example.com@autoreply.example.com }
= Components of an email address
func ParseAddress ¶
Parses an email_address to Addr{} or error
type Alias ¶
type Alias struct { Address string `json:"address" gorm:"primary_key"` Goto string `json:"goto"` Domain string `json:"domain"` Created string `json:"created"` Modified string `json:"modified"` Active int `json:"active"` }
Represents the alias table
func GetAliases ¶
type AliasPayload ¶
type AliasPayload struct { Success bool `json:"success"` // keep extjs happy Alias Alias `json:"alias"` Error string `json:"error"` }
func CreateAliasPayload ¶
func CreateAliasPayload() AliasPayload
type AliasesPayload ¶
type Config ¶
type Config struct { Debug bool `yaml:"debug" json:"debug" ` AuthSecret string `yaml:"auth_secret" json:"auth_secret" ` Db DbConf VacationDomain string `yaml:"vacation_domain" json:"vacation_domain" ` HTTPListen string `yaml:"http_listen" json:"http_listen"` IMAPAddress string `yaml:"imap_adddress" json:"imap_adddress"` SMTPLogin string `yaml:"smtp_login" json:"smtp_login"` }
type Domain ¶
type Domain struct { Domain string ` json:"domain"` Description string ` json:"description"` Aliases int ` json:"aliases"` Mailboxes int ` json:"mailboxes"` MaxQuota int ` json:"maxquota"` Quota int ` json:"quota"` Transport string ` json:"transport"` BackupMx int ` json:"backupmx"` Created string ` json:"created"` Modified string ` json:"modified"` Active int ` json:"active"` }
= A domain is a database in postfix
type DomainAllPayload ¶
type DomainAllPayload struct { Success bool `json:"success"` // keep extjs happy Domain Domain `json:"domain"` Mailboxes []Mailbox `json:"mailboxes"` Aliases []Alias `json:"aliases"` Error string `json:"error"` }
Ajax struct for `domain` all
type DomainPayload ¶
type DomainPayload struct { Success bool `json:"success"` // keep extjs happy Domain Domain `json:"domain"` Error string `json:"error"` }
= Ajax struct for `domain`
type DomainVirtualPayload ¶
type DomainVirtualPayload struct { Success bool `json:"success"` // keep extjs happy Domain Domain `json:"domain"` Mailboxes []*MailboxVirtual `json:"mailboxes"` Aliases []Alias `json:"aliases"` Error string `json:"error"` }
Ajax struct for `domain` all
type DomainsPayload ¶
type ErrPayload ¶
type ErrPayload struct { Success bool `json:"success"` // keep extjs happy Error string `json:"error"` }
= Ajax struct for `domain` all
type Mailbox ¶
type Mailbox struct { Username string `json:"username"` Password string `json:"password"` Name string `json:"name"` Maildir string `json:"maildir"` Quota int `json:"quota"` LocalPart string `json:"local_part"` Domain string `json:"domain"` Created string `json:"created"` Modified string `json:"modified"` Active bool `json:"active"` }
func GetMailboxes ¶
func LoadMailbox ¶
type MailboxPayload ¶
type MailboxPayload struct { Success bool `json:"success"` // keep extjs happy Mailbox Mailbox `json:"mailbox"` Error string `json:"error"` }
func CreateMailboxPayload ¶
func CreateMailboxPayload() MailboxPayload
type MailboxVirtual ¶
type MailboxVirtual struct { Mailbox Vacation *Vacation `json:"vacation"` ForwardOnly bool `json:"forward_only"` ForwardFrom []string `json:"forward_from"` ForwardTo []string `json:"forward_to"` }
func GetMailboxesVirtual ¶
func GetMailboxesVirtual(domain string) ([]*MailboxVirtual, error)
type MailboxesPayload ¶
type Vacation ¶
type Vacation struct { Email string ` json:"email" gorm:"primary_key" ` Subject string ` json:"subject" ` Body string ` json:"body" ` Activefrom string ` json:"active_from" ` Activeuntil string ` json:"active_until" ` Cache string ` json:"cache" ` Domain string ` json:"domain" ` IntervalTime int64 ` json:"interval_time" ` Created string ` json:"created" ` Modified string ` json:"modified" ` Active bool ` json:"active" ` }