server

package
v0.0.0-...-5b391e0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2020 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package server provides http handlers and middlewares.

Index

Constants

This section is empty.

Variables

View Source
var CrawlerAliases = []string{"bot", "crawler", "spider", "trendsmapresolver", "fetcher"}

CrawlerAliases are the names of possible crawler's user agents

View Source
var RequiredHeaders = []string{"Cf-Ipcountry", "Cf-Connecting-Ip", "X-Forwarded-For"}

RequiredHeaders are the headers we need to care about

Functions

func WithBotsAndCrawlersBlocking

func WithBotsAndCrawlersBlocking(next http.HandlerFunc) http.HandlerFunc

WithBotsAndCrawlersBlocking blocks bots and crawlers based on user agents of requests

func WithRequestHeadersLogging

func WithRequestHeadersLogging(next http.HandlerFunc) http.HandlerFunc

WithRequestHeadersLogging logs headers from RequiredHeaders

Types

type Server

type Server struct {
	Storage *sql.DB
	TStore  *app.TempStore
}

Server will have several handlers

func (*Server) FeedHandler

func (s *Server) FeedHandler() http.HandlerFunc

FeedHandler serves rss|atom|json feeds from items

func (*Server) FileHandler

func (s *Server) FileHandler(path string) http.HandlerFunc

FileHandler serves a file from a given path

func (*Server) HTMLHandler

func (s *Server) HTMLHandler() http.HandlerFunc

HTMLHandler serves html

func (*Server) JSONHandler

func (s *Server) JSONHandler(enableCors bool) http.HandlerFunc

JSONHandler serves json

func (*Server) LinkHandler

func (s *Server) LinkHandler(key *[32]byte) http.HandlerFunc

LinkHandler redirects encrypted links generated by 8hrs.xyz

func (*Server) SitemapHandler

func (s *Server) SitemapHandler(key *[32]byte) http.HandlerFunc

SitemapHandler serves sitemap.xml

Jump to

Keyboard shortcuts

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