Documentation ¶
Index ¶
- func Main(pass *Pass)
- func NewHTTPError(code int, parentError error) error
- type Pass
- func (p *Pass) GetConfigForAddon(name string, obj interface{})
- func (p *Pass) GetPassword(uuid string) (string, error)
- func (p *Pass) GetURL() string
- func (p *Pass) LoadTemplate(name string) *template.Template
- func (p *Pass) OutputHeaders(rw http.ResponseWriter, r *http.Request)
- func (p *Pass) RegisterRequestHandler(f func(http.Handler) http.Handler)
- func (p *Pass) RenderErrorPage(rw http.ResponseWriter, r *http.Request, err error)
- func (p *Pass) RenderPage(rw http.ResponseWriter, r *http.Request, innerTemplate *template.Template, ...)
- func (p *Pass) ResolveTemplatePath(templateSubPath string) string
- type TemplateVariables
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Main ¶
func Main(pass *Pass)
Main executes the main program, starts the https server, serves clients
func NewHTTPError ¶
NewHTTPError returns an instance of httpError which is required for RenderErrorPage for proper display and error logging
Types ¶
type Pass ¶
type Pass struct {
// contains filtered or unexported fields
}
Pass is a struct holding all required variables for wrappers, instanced using the CreatePass function
func CreatePass ¶
func CreatePass() *Pass
CreatePass returns a pointer to an instance of Pass for use in calls to Main(Pass) in main() functions of hooking applications
func (*Pass) GetConfigForAddon ¶
GetConfigForAddon returns a struct of the unmarshalled data from the server configuration If we fail here we exit the program with an error
func (*Pass) GetPassword ¶
GetPassword returns the password stored at the given UUID if any
func (*Pass) LoadTemplate ¶
LoadTemplate loads the referenced file and compiles it with the program layout specified with TemplatePath
func (*Pass) OutputHeaders ¶
func (p *Pass) OutputHeaders(rw http.ResponseWriter, r *http.Request)
OutputHeaders will output all security and cache headers required for the given request method
func (*Pass) RegisterRequestHandler ¶
RegisterRequestHandler allows an importer to hook the request handler, allows a sort of MITM for incoming requests, RequestHandlers must call f with a Pass instance if they want the request to continue via the main program logic
func (*Pass) RenderErrorPage ¶
RenderErrorPage outputs a rendered error template, no output must be made after a call to this function!
func (*Pass) RenderPage ¶
func (p *Pass) RenderPage(rw http.ResponseWriter, r *http.Request, innerTemplate *template.Template, tv interface{})
RenderPage renders the page using the configured layout and security headers
func (*Pass) ResolveTemplatePath ¶
ResolveTemplatePath returns the full path to the requested template file
type TemplateVariables ¶
type TemplateVariables struct { FormURL string `json:"-"` URL string `json:"url,omitempty"` UUID string `json:"uuid,omitempty"` Recipient string `json:"recipient,omitempty"` SenderID string `json:"senderid,omitempty"` Secret string `json:"secret,omitempty"` ErrorString string `json:"error,omitempty"` }
TemplateVariables TODO split to template specific structs