Documentation
¶
Index ¶
- Constants
- Variables
- func StaticDirMappingHookFunc() mapstructure.DecodeHookFunc
- func StringToTimeDurationHookFunc() mapstructure.DecodeHookFunc
- func URLMappingHookFunc() mapstructure.DecodeHookFunc
- type CacheConfig
- type CacheGlobs
- type Mapping
- type Mappings
- type Mock
- type Mocks
- type OptionsHandling
- type PortGroup
- type PortGroups
- type RequestMatcher
- type Response
- type RewriteOptions
- type RewritingOption
- type Script
- type Scripts
- type StaticDirectories
- type StaticDirectory
- type UncorsConfig
Constants ¶
View Source
const ( DefaultExpirationTime = 30 * time.Minute DefaultClearTime = 30 * time.Minute )
Variables ¶
View Source
var ( ErrNoToPair = errors.New("`to` values are not set for every `from`") ErrNoFromPair = errors.New("`from` values are not set for every `to`") )
Functions ¶
func StaticDirMappingHookFunc ¶ added in v0.1.0
func StaticDirMappingHookFunc() mapstructure.DecodeHookFunc
func StringToTimeDurationHookFunc ¶ added in v0.2.0
func StringToTimeDurationHookFunc() mapstructure.DecodeHookFunc
func URLMappingHookFunc ¶ added in v0.1.0
func URLMappingHookFunc() mapstructure.DecodeHookFunc
Types ¶
type CacheConfig ¶ added in v0.2.0
type CacheConfig struct {
ExpirationTime time.Duration `mapstructure:"expiration-time"`
ClearTime time.Duration `mapstructure:"clear-time"`
Methods []string `mapstructure:"methods"`
}
func (*CacheConfig) Clone ¶ added in v0.2.0
func (c *CacheConfig) Clone() *CacheConfig
type CacheGlobs ¶ added in v0.2.0
type CacheGlobs []string
func (CacheGlobs) Clone ¶ added in v0.2.0
func (g CacheGlobs) Clone() CacheGlobs
type Mapping ¶ added in v0.1.0
type Mapping struct {
From string `mapstructure:"from"`
To string `mapstructure:"to"`
Statics StaticDirectories `mapstructure:"statics"`
Mocks Mocks `mapstructure:"mocks"`
Scripts Scripts `mapstructure:"scripts"`
Cache CacheGlobs `mapstructure:"cache"`
Rewrites RewriteOptions `mapstructure:"rewrites"`
OptionsHandling OptionsHandling `mapstructure:"options-handling"`
// contains filtered or unexported fields
}
func (*Mapping) ClearCache ¶ added in v0.6.0
func (m *Mapping) ClearCache()
ClearCache clears the cached URL and its components. This is primarily used for testing.
func (*Mapping) GetFromHostPort ¶ added in v0.6.0
GetFromHostPort returns the host and port from the From URL, caching them on first access. This method combines URL parsing and host/port splitting to avoid redundant operations.
type Mappings ¶ added in v0.1.0
type Mappings []Mapping
func NormaliseMappings ¶ added in v0.1.0
func (Mappings) GroupByPort ¶ added in v0.6.0
func (m Mappings) GroupByPort() PortGroups
type Mock ¶ added in v0.1.0
type Mock struct {
Matcher RequestMatcher `mapstructure:",squash"`
Response Response `mapstructure:"response"`
}
type OptionsHandling ¶ added in v0.5.0
type OptionsHandling struct {
Disabled bool `mapstructure:"disabled"`
Headers map[string]string `mapstructure:"headers"`
Code int `mapstructure:"code"`
}
func (*OptionsHandling) Clone ¶ added in v0.5.0
func (o *OptionsHandling) Clone() OptionsHandling
type PortGroups ¶ added in v0.6.0
type PortGroups []PortGroup
type RequestMatcher ¶ added in v0.6.0
type RequestMatcher struct {
Path string `mapstructure:"path"`
Method string `mapstructure:"method"`
Queries map[string]string `mapstructure:"queries"`
Headers map[string]string `mapstructure:"headers"`
}
func (*RequestMatcher) Clone ¶ added in v0.6.0
func (r *RequestMatcher) Clone() RequestMatcher
func (*RequestMatcher) IsPathOnly ¶ added in v0.6.0
func (r *RequestMatcher) IsPathOnly() bool
type Response ¶ added in v0.1.0
type RewriteOptions ¶ added in v0.4.0
type RewriteOptions []RewritingOption
func (RewriteOptions) Clone ¶ added in v0.4.0
func (r RewriteOptions) Clone() RewriteOptions
type RewritingOption ¶ added in v0.4.0
type RewritingOption struct {
From string `mapstructure:"from"`
To string `mapstructure:"to"`
Host string `mapstructure:"host"`
}
func (RewritingOption) Clone ¶ added in v0.4.0
func (r RewritingOption) Clone() RewritingOption
type Script ¶ added in v0.6.0
type Script struct {
Matcher RequestMatcher `mapstructure:",squash"`
Script string `mapstructure:"script"`
File string `mapstructure:"file"`
}
type StaticDirectories ¶ added in v0.1.0
type StaticDirectories []StaticDirectory
func (StaticDirectories) Clone ¶ added in v0.1.0
func (s StaticDirectories) Clone() StaticDirectories
type StaticDirectory ¶ added in v0.1.0
type StaticDirectory struct {
Path string `mapstructure:"path"`
Dir string `mapstructure:"dir"`
Index string `mapstructure:"index"`
}
func (*StaticDirectory) Clone ¶ added in v0.1.0
func (s *StaticDirectory) Clone() StaticDirectory
func (*StaticDirectory) String ¶ added in v0.2.0
func (s *StaticDirectory) String() string
type UncorsConfig ¶ added in v0.1.0
type UncorsConfig struct {
HTTPPort int `mapstructure:"http-port"`
Mappings Mappings `mapstructure:"mappings"`
Proxy string `mapstructure:"proxy"`
Debug bool `mapstructure:"debug"`
CacheConfig CacheConfig `mapstructure:"cache-config"`
}
func LoadConfiguration ¶ added in v0.1.0
func LoadConfiguration(viperInstance *viper.Viper, args []string) *UncorsConfig
Source Files
¶
Click to show internal directories.
Click to hide internal directories.