Documentation
¶
Index ¶
- func AddCustomDirectory(toAdd string)
- func AddUpstreams(allToAdd []Upstream)
- func ClearUpstreams()
- func CustomDirectories() []string
- func FromMapOfArrayOfStrings(original map[string]arrayOrString) map[string][]string
- func Initialize(baseDir string)
- func RemoveCustomDirectory(toRemove string)
- func Upstreams() map[string]Upstream
- func UpstreamsPerFile() map[string][]Upstream
- type BaseEndpoint
- type Endpoint
- type Endpoints
- type ProxyEndpoint
- type StaticEndpoint
- type Upstream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCustomDirectory ¶ added in v1.2.0
func AddCustomDirectory(toAdd string)
AddCustomDirectory adds a directory to the current list of directories
func AddUpstreams ¶
func AddUpstreams(allToAdd []Upstream)
AddUpstreams add an array of upstreams to the available upstreams
func ClearUpstreams ¶ added in v1.2.0
func ClearUpstreams()
ClearUpstreams remove all previously configured upstreams
func CustomDirectories ¶ added in v1.2.0
func CustomDirectories() []string
CustomDirectories return all the custom directories configured
func FromMapOfArrayOfStrings ¶
FromMapOfArrayOfStrings converts a map of arrayOrString to a map of array of strings
func Initialize ¶
func Initialize(baseDir string)
Initialize loads all upstreams and initalize a routine to refresh the read files
func RemoveCustomDirectory ¶ added in v1.2.0
func RemoveCustomDirectory(toRemove string)
RemoveCustomDirectory removes a specific directory from the list
func UpstreamsPerFile ¶
UpstreamsPerFile returns a map with all upstreams grouped by file where they were loaded from
Types ¶
type BaseEndpoint ¶
type BaseEndpoint struct {
From string `json:"from"`
Regexp string `json:"regexp"`
UpstreamName string `json:"upstreamName"`
// contains filtered or unexported fields
}
BaseEndpoint represents a base endpoint route
func (*BaseEndpoint) Matches ¶
func (m *BaseEndpoint) Matches(req *http.Request) bool
Matches check if the request matches the request
func (*BaseEndpoint) Path ¶
func (m *BaseEndpoint) Path() string
Path returns the matching path for an endpoint
type Endpoint ¶
type Endpoint interface {
Handle(*http.Request) (int, string, map[string][]string, io.ReadCloser)
Matches(*http.Request) bool
Path() string
}
Endpoint represents one route inside an Upstream
type ProxyEndpoint ¶
type ProxyEndpoint struct {
BaseEndpoint
Headers map[string][]string `json:"headers"`
To string `json:"to"`
}
ProxyEndpoint proxy requests to another HTTP/S server
type StaticEndpoint ¶
type StaticEndpoint struct {
BaseEndpoint
To string `json:"to"`
}
StaticEndpoint is an endpoint that responds with file from disk
type Upstream ¶
type Upstream struct {
Name string `json:"name"`
Origin configuration.Origin `json:"origin"`
ProxyEndpoints []*ProxyEndpoint `json:"proxyEndpoints"`
StaticEndpoints []*StaticEndpoint `json:"staticEndpoints"`
}
Upstream represents a place where requests can be directed to
func ScanFilesInDirectories ¶ added in v1.2.0
ScanFilesInDirectories scans a set of directories to search for upstreams