Version: v0.0.0-...-31cff5b Latest Latest

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

Go to latest
Published: Dec 2, 2020 License: Apache-2.0 Imports: 10 Imported by: 0



Package handler provides the http handlers for handling HTTP requests for Go Vanity imports.



This section is empty.


This section is empty.


This section is empty.


type Handler

type Handler struct {
	// contains filtered or unexported fields

Handler is the request handler.

func Init

func Init(ctx context.Context, vanityConfig string) (*Handler, error)

Init initializes the global handler. This is non-idiomatic but is optimised for google cloud functions. The config is parsed from a yaml file that is; - Fetched from an external source (an HTTP endpoint). - Present locally on the filesystem If both options are provided, the local file is ignored.

func (*Handler) HandleImport

func (h *Handler) HandleImport(w http.ResponseWriter, r *http.Request)

HandleImport handles Go's vanity import requests.

func (*Handler) HandleIndex

func (h *Handler) HandleIndex(w http.ResponseWriter, r *http.Request)

HandleIndex serves the list of all supported paths for this host. This is in response to the `/` path.

func (*Handler) Host

func (h *Handler) Host(r *http.Request) string

Host returns a the host.

Source Files

Jump to

Keyboard shortcuts

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