Documentation ¶
Index ¶
- Variables
- func Debugln(v ...interface{})
- func FaviconICO(w http.ResponseWriter, r *http.Request)
- func FaviconPNG(w http.ResponseWriter, r *http.Request)
- func GetRenderTime(c context.Context) string
- func GetScheme(r *http.Request) (scheme string)
- func ImgClass(s string) string
- func ImgExt(s string) string
- func Logger(next http.Handler) http.Handler
- func PrettyDate(date int64) string
- func RandBytes(n int) ([]byte, error)
- func RandKey(n int) (string, error)
- func Robots(w http.ResponseWriter, r *http.Request)
- func SafeHTML(s string) template.HTML
- func ServeContent(w http.ResponseWriter, r *http.Request, dir, file string)
- func StaticInit()
- func TimeTrack(start time.Time, name string)
- func Timer(next http.Handler) http.Handler
Constants ¶
This section is empty.
Variables ¶
var ( Debug bool Logfile string )
Functions ¶
func FaviconICO ¶
func FaviconICO(w http.ResponseWriter, r *http.Request)
func FaviconPNG ¶
func FaviconPNG(w http.ResponseWriter, r *http.Request)
func GetRenderTime ¶
GetRenderTime calculates the time an HTTP request took, if the Logger middleware was used
func GetScheme ¶
GetScheme is a hack to allow me to make full URLs due to absence of http:// from URL.Scheme in dev situations When behind Nginx, use X-Forwarded-Proto header to retrieve this, then just tack on "://" getScheme(r) should return http:// or https://
func Logger ¶
Logger is my custom logging middleware It prints all HTTP requests to a file called http.log, as well as helps the expvarHandler log the status codes
func PrettyDate ¶
func ServeContent ¶
func ServeContent(w http.ResponseWriter, r *http.Request, dir, file string)
ServeContent checks for file existence, and if there, serves it so it can be cached
func StaticInit ¶
func StaticInit()
StaticInit initializes handlers for /assets/, /robots.txt, /favicon.ico, and /favicon.png
Types ¶
This section is empty.