shared

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: GPL-3.0 Imports: 4 Imported by: 5

Documentation

Index

Constants

View Source
const ConfigKey = "config"
View Source
const IndexFile = "index.html"
View Source
const UIAssetsLocation = "ui/dist/assets"
View Source
const UILocation = "ui/dist"
View Source
const WiretapPortPlaceholder = "%WIRETAP_PORT%"

Variables

This section is empty.

Functions

func MarshalError added in v0.0.8

func MarshalError(err *WiretapError) []byte

func Pluralize added in v0.0.15

func Pluralize(n int, singular string, plural string) string

Types

type CompiledPath added in v0.0.13

type CompiledPath struct {
	PathConfig          *WiretapPathConfig
	CompiledKey         glob.Glob
	CompiledTarget      glob.Glob
	CompiledPathRewrite map[string]*regexp.Regexp
}

type CompiledPathRewrite added in v0.0.13

type CompiledPathRewrite struct {
	PathConfig     *WiretapPathConfig
	Key            string
	CompiledKey    glob.Glob
	CompiledTarget glob.Glob
}

type WiretapConfiguration

type WiretapConfiguration struct {
	Contract            string                        `json:"-" yaml:"-"`
	RedirectHost        string                        `json:"redirectHost,omitempty" yaml:"redirectHost,omitempty"`
	RedirectPort        string                        `json:"redirectPort,omitempty" yaml:"redirectPort,omitempty"`
	RedirectBasePath    string                        `json:"redirectBasePath,omitempty" yaml:"redirectBasePath,omitempty"`
	RedirectProtocol    string                        `json:"redirectProtocol,omitempty" yaml:"redirectProtocol,omitempty"`
	RedirectURL         string                        `json:"redirectURL,omitempty" yaml:"redirectURL,omitempty"`
	Port                string                        `json:"port,omitempty" yaml:"port,omitempty"`
	MonitorPort         string                        `json:"monitorPort,omitempty" yaml:"monitorPort,omitempty"`
	WebSocketPort       string                        `json:"webSocketPort,omitempty" yaml:"webSocketPort,omitempty"`
	GlobalAPIDelay      int                           `json:"globalAPIDelay,omitempty" yaml:"globalAPIDelay,omitempty"`
	StaticDir           string                        `json:"staticDir,omitempty" yaml:"staticDir,omitempty"`
	StaticIndex         string                        `json:"staticIndex,omitempty" yaml:"staticIndex,omitempty"`
	PathConfigurations  map[string]*WiretapPathConfig `json:"paths,omitempty" yaml:"paths,omitempty"`
	Headers             *WiretapHeaderConfig          `json:"headers,omitempty" yaml:"headers,omitempty"`
	StaticPaths         []string                      `json:"staticPaths,omitempty" yaml:"staticPaths,omitempty"`
	StaticPathsCompiled []glob.Glob                   `json:"-" yaml:"-"`
	CompiledPaths       map[string]*CompiledPath      `json:"-"`
	FS                  embed.FS                      `json:"-"`
}

func (*WiretapConfiguration) CompilePaths added in v0.0.13

func (wtc *WiretapConfiguration) CompilePaths()

type WiretapError added in v0.0.8

type WiretapError struct {
	Type     string `json:"type,omitempty"`   // URI reference to the type of problem
	Title    string `json:"title"`            // A short description of the issue
	Status   int    `json:"status,omitempty"` // HTTP status code.
	Detail   string `json:"detail"`           // explanation of the issue in detail.
	Instance string `json:"instance"`         // URI to the specific problem.
}

WiretapError is an rfc7807 compliant error struct

func GenerateError added in v0.0.8

func GenerateError(title string,
	status int,
	detail string,
	instance string) *WiretapError

type WiretapHeaderConfig added in v0.0.15

type WiretapHeaderConfig struct {
	DropHeaders []string `json:"drop,omitempty" yaml:"drop,omitempty"`
}

type WiretapPathConfig added in v0.0.13

type WiretapPathConfig struct {
	Target       string            `json:"target,omitempty" yaml:"target,omitempty"`
	PathRewrite  map[string]string `json:"pathRewrite,omitempty" yaml:"pathRewrite,omitempty"`
	CompiledPath *CompiledPath     `json:"-"`
	Secure       bool              `json:"secure,omitempty" yaml:"secure"`
}

func (*WiretapPathConfig) Compile added in v0.0.13

func (wpc *WiretapPathConfig) Compile(key string) *CompiledPath

Jump to

Keyboard shortcuts

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