web

package
v0.0.0-...-01732ca Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2018 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSessionCookie

func GetSessionCookie(req *http.Request) *http.Cookie

GetSessionCookie gets the cookie named "session" from http.Cookies()

func GetSessionUser

func GetSessionUser(databaseConnection db.DatabaseConnection, req *http.Request) (db.User, error)

GetSessionUser gets the user associated with a session within a *http.Request.

func StoreFile

func StoreFile(databaseConnection db.DatabaseConnection, uploadLocation string, blockID uuid.UUID, bytes []byte) (int, error)

StoreFile stores an incoming file to disk, with its SHA256 as its username

Types

type LoggableResponseWriter

type LoggableResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

LoggableResponseWriter allows access to otherwise hidden information within ResponseWriter

func NewLoggableResponseWriter

func NewLoggableResponseWriter(writer http.ResponseWriter) LoggableResponseWriter

NewLoggableResponseWriter creats a LoggableResponseWriter with the given http.ResponseWriter

func (*LoggableResponseWriter) Write

func (writer *LoggableResponseWriter) Write(bytes []byte) (int, error)

Write is identical to http.ResponseWriter.Write, but stores the bytes sent and accounts for the 200 special case that Write normally handles by the interface's definition.

func (*LoggableResponseWriter) WriteHeader

func (writer *LoggableResponseWriter) WriteHeader(statusCode int)

WriteHeader is identical to http.Responsewriter.WriteHeader, but stores the status code.

type RouteHandler

type RouteHandler struct {
	// contains filtered or unexported fields
}

RouteHandler holds all routes and allows them to share common variables

type Webserver

type Webserver struct {
	Server *http.Server
	// contains filtered or unexported fields
}

Webserver hosts a webserver for sms-pusher

func NewWebserver

func NewWebserver(listenAddr string, databaseConnection db.DatabaseConnection, sendChannel chan<- firebasexmpp.DownstreamPayload, logger *logrus.Logger) (Webserver, error)

NewWebserver creats a new Webserver with httpServer being set to a new http.Server

Jump to

Keyboard shortcuts

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