Documentation
¶
Index ¶
- type MapLocal
- func (ml *MapLocal) AddRule(r Rule)
- func (ml *MapLocal) LoadFromFile(path string) error
- func (ml *MapLocal) Match(host, path string) ([]byte, int, bool)
- func (ml *MapLocal) RemoveRule(index int)
- func (ml *MapLocal) RuleCount() int
- func (ml *MapLocal) Rules() []Rule
- func (ml *MapLocal) SaveToFile(path string) error
- type Rule
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MapLocal ¶
type MapLocal struct {
// contains filtered or unexported fields
}
MapLocal holds rules for serving local files instead of upstream responses.
func (*MapLocal) LoadFromFile ¶
LoadFromFile loads rules from a JSON file (array of Rule objects).
func (*MapLocal) Match ¶
Match checks if a host+path matches any rule. Returns body, status, and whether matched. Falls through (returns false) if the local file doesn't exist.
func (*MapLocal) RemoveRule ¶
RemoveRule removes the rule at the given index.
func (*MapLocal) SaveToFile ¶
SaveToFile persists current rules to a JSON file.
Click to show internal directories.
Click to hide internal directories.