mapping

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2018 License: MIT Imports: 14 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetStatus

func SetStatus(mappingID string, status bool) error

SetStatus change the status of a mapping and save the new state to disk so that it will get loaded on next start

Types

type DynamicMapping

type DynamicMapping struct {
	Active    bool   `json:"active"`
	From      string `json:"from"`
	MappingID string `json:"mappingID"`
	Origin    string `json:"origin"`
	Proxy     bool   `json:"proxy"`
	Regexp    string `json:"regexp"`
	To        string `json:"to"`
}

DynamicMapping represents a mapping that can be active or not

func GetMappings

func GetMappings() ([]DynamicMapping, error)

GetMappings get all mappings or load them if not loaded so far

func (*DynamicMapping) Match

func (mapping *DynamicMapping) Match(req *http.Request) *MatchResult

Match tests if the mapping matches the specific request. If it does it will return a match result, otherwise it will return nil.

type Mapping

type Mapping struct {
	From      string `json:"from"`
	MappingID string `json:"mappingID"`
	Origin    string `json:"origin"`
	Proxy     bool   `json:"proxy"`
	Regexp    string `json:"regexp"`
	To        string `json:"to"`
}

Mapping represents a mapping configuration loaded from some file.

type MatchResult

type MatchResult struct {
	Mapping DynamicMapping
	NewPath string
	Parts   []string
}

MatchResult stores the result for a mapping that matched a request

Jump to

Keyboard shortcuts

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