Documentation ¶
Overview ¶
Package xsrftoken provides methods for generating and validating secure XSRF tokens.
The web package contains all the code to provide SMTPD's web GUI
Index ¶
- Variables
- func FileSize(s int64) string
- func GreyMailFromAdd(w http.ResponseWriter, r *http.Request, ctx *Context) (err error)
- func GreyMailToAdd(w http.ResponseWriter, r *http.Request, ctx *Context) (err error)
- func Home(w http.ResponseWriter, r *http.Request, ctx *Context) (err error)
- func Initialize(cfg config.WebConfig, ds *data.DataStore)
- func Login(w http.ResponseWriter, req *http.Request, ctx *Context) error
- func LoginForm(w http.ResponseWriter, req *http.Request, ctx *Context) (err error)
- func Logout(w http.ResponseWriter, req *http.Request, ctx *Context) error
- func MailAttachment(w http.ResponseWriter, r *http.Request, ctx *Context) (err error)
- func MailDelete(w http.ResponseWriter, r *http.Request, ctx *Context) (err error)
- func MailList(w http.ResponseWriter, r *http.Request, ctx *Context) (err error)
- func MailView(w http.ResponseWriter, r *http.Request, ctx *Context) (err error)
- func NginxHTTPAuth(w http.ResponseWriter, r *http.Request, ctx *Context) error
- func ParseTemplate(name string, partial bool) (*template.Template, error)
- func Ping(w http.ResponseWriter, r *http.Request, ctx *Context) error
- func Register(w http.ResponseWriter, req *http.Request, ctx *Context) error
- func RegisterForm(w http.ResponseWriter, req *http.Request, ctx *Context) (err error)
- func RenderPartial(name string, w http.ResponseWriter, data interface{}) error
- func RenderTemplate(name string, w http.ResponseWriter, data interface{}) error
- func Start()
- func Status(w http.ResponseWriter, r *http.Request, ctx *Context) (err error)
- func Stop()
- type CSRF
- type Context
- type Pagination
Constants ¶
This section is empty.
Variables ¶
var DataStore *data.DataStore
var Router *mux.Router
var TemplateFuncs = template.FuncMap{
"htmlSafe": htmlSafe,
"friendlyTime": friendlyTime,
"reverse": reverse,
"textToHtml": textToHtml,
}
var Websocket *incus.Server
Functions ¶
func GreyMailFromAdd ¶
func GreyMailToAdd ¶
func Initialize ¶
Initialize sets up things for unit tests or the Start() method
func MailAttachment ¶
func MailDelete ¶
func NginxHTTPAuth ¶
If running Nginx as a proxy, give Nginx the IP address and port for the SMTP server Primary use of Nginx is to terminate TLS so that Go doesn't need to deal with it. This could perform auth and load balancing too See http://wiki.nginx.org/MailCoreModule
func ParseTemplate ¶
ParseTemplate loads the requested template along with _base.html, caching the result (if configured to do so)
func RegisterForm ¶
func RenderPartial ¶
func RenderPartial(name string, w http.ResponseWriter, data interface{}) error
RenderPartial fetches the named template and renders it to the provided ResponseWriter.
func RenderTemplate ¶
func RenderTemplate(name string, w http.ResponseWriter, data interface{}) error
RenderTemplate fetches the named template and renders it to the provided ResponseWriter.
Types ¶
type CSRF ¶
type CSRF struct { // Key is a secret key for your application. Key string // ID is a unique identifier for the user. Id string // actionID is the action the user is taking (e.g. POSTing to a particular path) Action string // The duration that XSRF tokens are valid. 20 * time.Minute Timeout time.Duration }
type Context ¶
type Pagination ¶
type Pagination struct {
// contains filtered or unexported fields
}
func NewPagination ¶
func NewPagination(total int, limit int, curpage int, url string) *Pagination
func (*Pagination) Limit ¶
func (p *Pagination) Limit() int
func (*Pagination) Offset ¶
func (p *Pagination) Offset() int
func (*Pagination) Pages ¶
func (p *Pagination) Pages() int
func (*Pagination) Paginate ¶
func (p *Pagination) Paginate()
func (*Pagination) Total ¶
func (p *Pagination) Total() int