port

package
v0.0.0-...-2e3c079 Latest Latest
Warning

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

Go to latest
Published: May 19, 2020 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultHandler

func DefaultHandler(tpl *template.Template, startpagetext string, assetList AssetList) http.HandlerFunc

func FaviconHandler

func FaviconHandler(favicondata []byte) http.HandlerFunc

func FontHandler

func FontHandler(woff2 bool, fontdata []byte) http.HandlerFunc

func GeminiHandler

func GeminiHandler(tpl *template.Template, robotsdata *robotstxt.RobotsData, assetList AssetList, robotsdebug bool) http.HandlerFunc

func GopherHandler

func GopherHandler(tpl *template.Template, robotsdata *robotstxt.RobotsData, assetList AssetList, robotsdebug bool) http.HandlerFunc

GopherHandler returns a Handler that proxies requests to the specified Gopher server as denoated by the first argument to the request path and renders the content using the provided template. The optional robots parameters points to a robotstxt.RobotsData struct to test user agents against a configurable robotst.txt file.

func JavaScriptHandler

func JavaScriptHandler(jsdata []byte) http.HandlerFunc

func ListenAndServe

func ListenAndServe(bind, startpagefile string, robotsfile string, robotsdebug bool, vipsconcurrency int) error

ListenAndServe creates a listening HTTP server bound to the interface specified by bind and sets up a Gopher to HTTP proxy proxying requests as requested and by default will prozy to a Gopher server address specified by uri if no servers is specified by the request. The robots argument is a pointer to a robotstxt.RobotsData struct for testing user agents against a configurable robots.txt file.

func RobotsTxtHandler

func RobotsTxtHandler(robotstxtdata []byte) http.HandlerFunc

RobotsTxtHandler returns the contents of the robots.txt file if configured and valid.

func StyleHandler

func StyleHandler(styledata []byte) http.HandlerFunc

Types

type AssetList

type AssetList struct {
	Style         string
	JS            string
	FontRegularW  string
	FontRegularW2 string
	FontBoldW     string
	FontBoldW2    string
}

type GeminiNavItem

type GeminiNavItem struct {
	Label   string
	URL     string
	Current bool
}

type GeminiSection

type GeminiSection struct {
	Type  string
	Text  string
	URL   template.URL
	Items []string
}

type GeminiTemplateVariables

type GeminiTemplateVariables struct {
	Title    string
	URL      string
	Assets   AssetList
	Sections []GeminiSection
	Nav      []GeminiNavItem
	IsPlain  bool
}

type GopherItem

type GopherItem struct {
	Link template.URL
	Type string
	Text string
}

type GopherNavItem

type GopherNavItem struct {
	Label   string
	URL     string
	Current bool
}

Jump to

Keyboard shortcuts

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