Documentation
¶
Overview ¶
Package vanity provides utilities for building vanity Go import servers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsGoGet ¶
IsGoGet returns a boolean indicating whether req is a go get HTTP request.
func RedirectToGodoc ¶
func RedirectToGodoc(w http.ResponseWriter, req *http.Request)
RedirectToGodoc redirects req to the corresponding godoc page.
The redirect URL is derived from req.Host and req.URL.Path. For example, a request to example.com/foo/bar is redirected to godoc.org/example.com/foo/bar.
Types ¶
type ImportPath ¶
ImportPath defines a mapping between Go import paths.
func (ImportPath) TagFor ¶
func (ip ImportPath) TagFor(req *http.Request) (*ImportTag, error)
TagFor returns the import tag for the request req.
TagFor verifies that the import path specified by req is either identical to ip.From or a sub-path of it.
It returns an ImportTag pointing to the root of the import path, ip.From.
For example, given ip.From == "acln.ro/foo" and a request to "acln.ro/foo/bar", the returned ImportTag would have .ImportPath == "acln.ro/foo".
func (ImportPath) WildcardTagFor ¶
func (ip ImportPath) WildcardTagFor(req *http.Request) (*ImportTag, error)
WildcardTagFor returns the wildcard import tag for the request req.
TagFor verifies that the import path specified by req is a strict sub-path of ip.From.
It returns an ImportTag pointing to the root of the import path, based on the first child element of the import path, beyond ip.From.
For example, given ip.From == "acln.ro" and a request to "acln.ro/foo/bar", the returned ImportTag would have .ImportPath == "acln.ro/foo".
type ImportTag ¶
ImportTag represents an HTML go-import meta tag understood by the go tool.