server

package
v0.0.0-...-204aec8 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2024 License: GPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Request  *http.Request
	Response http.ResponseWriter
	Srv      *HTTPServer
	T        *template.Template
	Status   int
	Err      error
	Time     time.Time

	Token jwt.Token

	Data webData
}

func (*Context) Admin

func (c *Context) Admin() bool

func (*Context) CheckXsrf

func (c *Context) CheckXsrf() (ok bool)

CheckXsrf validates the xsrf token

func (*Context) Error

func (c *Context) Error(i interface{})

func (*Context) Exec

func (c *Context) Exec()

func (*Context) Forbidden

func (c *Context) Forbidden()

func (*Context) Form

func (c *Context) Form(name string) string

func (*Context) FormSlice

func (c *Context) FormSlice(name string) []string

func (*Context) Forwarded

func (c *Context) Forwarded() (ret string)

func (*Context) LogSetCookie

func (c *Context) LogSetCookie(msg string, err error)

func (*Context) LoggedOn

func (c *Context) LoggedOn() (ok bool)

func (*Context) Login

func (c *Context) Login(u *core.User, remember string)

func (*Context) Method

func (c *Context) Method() string

func (*Context) NotFound

func (c *Context) NotFound()

func (*Context) Path

func (c *Context) Path() string

func (*Context) Redirect

func (c *Context) Redirect(uri string, code int)

func (*Context) Referer

func (c *Context) Referer() string

func (*Context) RefererURI

func (c *Context) RefererURI() string

func (*Context) Remember

func (c *Context) Remember() string

func (*Context) SetCookie

func (c *Context) SetCookie(claims jwt.Claims, d time.Duration)

func (*Context) SetHeader

func (c *Context) SetHeader(name, value string)

func (*Context) Template

func (c *Context) Template(name string)

func (*Context) Totp

func (c *Context) Totp() string

func (*Context) User

func (c *Context) User() string

func (*Context) Var

func (c *Context) Var(name string) (ret string)

func (*Context) Write

func (c *Context) Write(buf []byte) (err error)

type HTTPServer

type HTTPServer struct {
	Config *core.Config

	DB  *db.DB
	JWT *jwt.JWT
	// contains filtered or unexported fields
}

func NewHTTPServer

func NewHTTPServer(cfg *core.Config, l net.Listener) (srv *HTTPServer)

func (*HTTPServer) Start

func (s *HTTPServer) Start() (err error)

func (*HTTPServer) Stop

func (s *HTTPServer) Stop() error

Jump to

Keyboard shortcuts

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