internal

package
v0.0.0-...-32194ba Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2024 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDefaultHeaders

func AddDefaultHeaders(h http.Header)

func AddDefaultHeadersWithCache

func AddDefaultHeadersWithCache(h http.Header)

func CreateHttpServer

func CreateHttpServer(shutdown chan<- error) *http.Server

func NotFoundHandler

func NotFoundHandler(w http.ResponseWriter, pr *ParsedRequest)

func OnExit

func OnExit(messages ...string)

func OptionsHandler

func OptionsHandler(w http.ResponseWriter)

func RedirectInfoHandler

func RedirectInfoHandler(w http.ResponseWriter, pr *ParsedRequest)

func Run

func Run() error

func ServerHandler

func ServerHandler(w http.ResponseWriter, r *http.Request)

func Setup

func Setup()

func SetupEnvironment

func SetupEnvironment()

func SetupLogging

func SetupLogging()

func StartBackgroundUpdates

func StartBackgroundUpdates(targetChannel chan<- state.RedirectMap, lastErrorChannel chan<- error, quitChannel <-chan bool)

func StatusHealthHandler

func StatusHealthHandler(w http.ResponseWriter, r *http.Request)

func StatusInfoHandler

func StatusInfoHandler(w http.ResponseWriter, r *http.Request)

func UpdateRedirectMapping

func UpdateRedirectMapping(target chan<- state.RedirectMap, lastError chan<- error, force bool)

Types

type AdminCredentials

type AdminCredentials struct {
	UserHash []byte
	PassHash []byte
}

type AppConfig

type AppConfig struct {
	IgnoreCaseInPath      bool
	ShowServerHeader      bool
	Port                  uint16
	UpdatePeriod          uint32
	HttpCacheMaxAge       uint32
	CacheControlHeader    string
	StatusEndpointEnabled bool
	UseETag               bool
	UseRedirectBody       bool
	AdminCredentials      *AdminCredentials
	Favicon               string
	AllowRootRedirect     bool
	FallbackFile          string
	ShowRepositoryLink    bool
}

func CreateAppConfig

func CreateAppConfig() *AppConfig

func (*AppConfig) UseFallbackFile

func (ac *AppConfig) UseFallbackFile() bool

type FallbackFileEntry

type FallbackFileEntry struct {
	Key    string `json:"key"`
	Target string `json:"target"`
}

type NotFoundTemplateData

type NotFoundTemplateData struct {
	RedirectName string
}

type ParsedRequest

type ParsedRequest struct {
	Original       *http.Request
	Target         string
	NormalizedPath string
	Found          bool
	InfoRequest    bool
	NoBodyRequest  bool
}

func RedirectTargetForRequest

func RedirectTargetForRequest(r *http.Request) *ParsedRequest

type RedirectInfoTemplateData

type RedirectInfoTemplateData struct {
	RedirectName string
	Target       string
}

type StatusHealthcheck

type StatusHealthcheck struct {
	MappingSize int        `json:"mappingSize"`
	Running     bool       `json:"running"`
	Healthy     bool       `json:"healthy"`
	LastUpdate  *time.Time `json:"lastUpdate"`
}

type StatusInfo

type StatusInfo struct {
	Mapping       state.RedirectMap `json:"mapping"`
	SpreadsheetId string            `json:"spreadsheetId"`
	LastUpdate    *time.Time        `json:"lastUpdate"`
	LastModified  *time.Time        `json:"lastModified"`
	LastError     string            `json:"lastError,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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