gopherproxy

package
v0.0.0-...-3f53507 Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ITEM_TYPE_GEMINI_LINE = ""
	ITEM_TYPE_GEMINI_LINK = " =>"
)

Variables

View Source
var (
	TermEscapeSGRPattern = regexp.MustCompile("�\\[\\d+(;\\d+)*m")
)

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
	FontW      string
	FontW2     string
	PropFontW  string
	PropFontW2 string
}

type Item

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

type TemplateVariables

type TemplateVariables struct {
	Title    string
	URI      string
	Assets   AssetList
	RawText  string
	Lines    []Item
	Error    bool
	Protocol string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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