diecast

package module
v1.22.1 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2022 License: LGPL-2.1 Imports: 121 Imported by: 10

README

GoDoc

tl;dr

Diecast is an all-in-one program that lets you build websites using conventional web programming tools (HTML, JavaScript, CSS/Sass) as well as a rich templating framework for handling complex tasks server-side. A key feature is the use of data bindings, which allows your templates to consume remote content (RESTful APIs, Redis, and more). This declarative approach eliminates many of the ambiguities that regularly appear in conventional MVC/server-side frameworks.

Introduction

Diecast is a web server that allows you to render a directory tree of template files into HTML, CSS or anything other text-based media in real-time. Data can be retrieved from remote sources during the template rendering process, creating dynamic web pages built by consuming APIs and remote files without the need to use client-side Javascript/AJAX calls or an intermediate server framework.

Documentation

You can read the complete Diecast manual at https://ghetzel.github.io/diecast.

Documentation

Index

Constants

View Source
const (
	ActionSummarize BindingErrorAction = `summarize`
	ActionPrint                        = `print`
	ActionContinue                     = `continue`
	ActionBreak                        = `break`
	ActionIgnore                       = `ignore`
)
View Source
const (
	SameSiteDefault CookieSameSite = ``
	SameSiteLax                    = `lax`
	SameSiteStrict                 = `strict`
	SameSiteNone                   = `none`
)
View Source
const ApplicationName = `diecast`
View Source
const ApplicationSummary = `a standalone site templating engine that consumes REST services and renders static HTML output in realtime`
View Source
const ApplicationVersion = `1.22.0`
View Source
const ContentTemplateName = `content`
View Source
const ContextCsrfToken = `csrf-token`
View Source
const ContextErrorKey = `response-error-message`
View Source
const ContextRequestKey = `diecast-request-id`
View Source
const ContextResponseKey = `diecast-response`
View Source
const ContextStatusKey = `response-status-code`
View Source
const CsrfTokenLength = 32
View Source
const DebuggingQuerystringParam = `__viewsource`
View Source
const DefaultAddress = `127.0.0.1:28419`
View Source
const DefaultColorPalette = `munin`
View Source
const DefaultConfigFile = `diecast.yml`
View Source
const DefaultCsrfInjectFieldFormat = `<input type="hidden" name="%s" value="%s">`
View Source
const DefaultCsrfInjectFormFieldSelector = `form[method="post"], form[method="POST"], form[method="Post"]` // if you need more case permutations than this, you may override this default
View Source
const DefaultErrorsPath = `/_errors`
View Source
const DefaultHeaderJoiner = `,`
View Source
const DefaultLayoutsPath = `/_layouts`
View Source
const DefaultQueryJoiner = `,`
View Source
const DefaultRoutePrefix = `/`
View Source
const DiecastUserAgentString = `diecast/` + ApplicationVersion
View Source
const JaegerSpanKey = `jaeger-span`
View Source
const LayoutTemplateName = `layout`
View Source
const RequestBodyKey = `request-body`
View Source
const SwitchCaseKey = `switch-case`

Variables

View Source
var AllowInsecureLoopbackBindings bool = true
View Source
var Base32Alphabet = base32.NewEncoding(`abcdefghijklmnopqrstuvwxyz234567`)
View Source
var BindingClient = &http.Client{
	Timeout: 60 * time.Second,
}
View Source
var ConvertRoundToPlaces = 12
View Source
var DartSassBin = executil.Env(`DIECAST_SASS_BIN`, `sass`)
View Source
var DefaultActionStepTimeout = 10 * time.Second
View Source
var DefaultAutocompressPatterns = []string{`*.zip`, `*.docx`, `*.xlsx`, `*.pptx`}
View Source
var DefaultAutoindexFilename = `/autoindex.html`
View Source
var DefaultAutolayoutPatterns = []string{
	`*.html`,
	`*.md`,
}
View Source
var DefaultBindingTimeout = 60 * time.Second
View Source
var DefaultCsrfCookieName = `csrf_token`
View Source
var DefaultCsrfFormFieldName = `csrf_token`
View Source
var DefaultCsrfHeaderName = `X-CSRF-Token`
View Source
var DefaultCsrfInjectMediaTypes = []string{
	`text/html`,
}
View Source
var DefaultFilterEnvVars = []string{
	`_*`,
	`*KEY*`,
	`*PASSWORD*`,
	`*PID*`,
	`*HOST*`,
	`*URL*`,
	`*SECRET*`,
	`*TOKEN*`,
	`AWS_ACCESS_KEY_ID`,
	`AWS_SECRET_ACCESS_KEY`,
	`PROMPT_COMMAND`,
	`PWD`,
}
View Source
var DefaultIndexFile = `index.html`
View Source
var DefaultLocale = language.AmericanEnglish
View Source
var DefaultLogFormat = `common`
View Source
var DefaultOauth2SessionCookieName = `DCO2SESSION`
View Source
var DefaultObjectifyKeyValueSeparator = `=`
View Source
var DefaultParamJoiner = `;`
View Source
var DefaultProtocol = `http`
View Source
var DefaultProxyMountTimeout = time.Duration(10) * time.Second
View Source
var DefaultRendererMappings = map[string]string{
	`md`:   `markdown`,
	`scss`: `sass`,
	`pptx`: `ooxml`,
	`xlsx`: `ooxml`,
	`docx`: `ooxml`,
}
View Source
var DefaultRequestBodyPreload int64 = 1048576
View Source
var DefaultShellSessionCookieName = `DCSESSION`
View Source
var DefaultTemplatePatterns = []string{`*.html`, `*.md`, `*.scss`}
View Source
var DefaultTryExtensions = []string{`html`, `md`}
View Source
var DefaultUpgrader = Upgrader{
	ReadBufferSize:  1024,
	WriteBufferSize: 1024,
	CheckOrigin: func(r *http.Request) bool {
		return true
	},
}
View Source
var DefaultVerifyFile = `/` + DefaultIndexFile
View Source
var DirectoryErr = errors.New(`is a directory`)
View Source
var ErrSkipEval = errors.New(`skip evaluation`)
View Source
var HeaderSeparator = []byte{'-', '-', '-'}
View Source
var HighlightTheme = `monokai`
View Source
var ITotallyUnderstandRunningArbitraryCommandsAsRootIsRealRealBad = false
View Source
var MaxBufferedBodySize int64 = 16535
View Source
var MountHaltErr = errors.New(`mount halted`)
View Source
var SassIndentString = `    `
View Source
var SharedBindingPollInterval time.Duration = 100 * time.Millisecond

100ms precision seems generous for this use case, but you *can* change it.

Functions

func ApplyJPath added in v1.12.12

func ApplyJPath(data interface{}, jpath string) (interface{}, error)

func DefaultFavicon added in v1.12.11

func DefaultFavicon() []byte

func Dir

func Dir(useLocal bool, name string) http.FileSystem

Dir returns a http.Filesystem for the embedded assets on a given prefix dir. If useLocal is true, the filesystem's contents are instead used.

func EvalInline

func EvalInline(input string, data map[string]interface{}, funcs FuncMap, names ...string) (string, error)

func FS

func FS(useLocal bool) http.FileSystem

FS returns a http.Filesystem for the embedded assets. If useLocal is true, the filesystem's contents are instead used.

func FSByte

func FSByte(useLocal bool, name string) ([]byte, error)

FSByte returns the named file from the embedded assets. If useLocal is true, the filesystem's contents are instead used.

func FSMustByte

func FSMustByte(useLocal bool, name string) []byte

FSMustByte is the same as FSByte, but panics if name is not present.

func FSMustString

func FSMustString(useLocal bool, name string) string

FSMustString is the string version of FSMustByte.

func FSString

func FSString(useLocal bool, name string) (string, error)

FSString is the string version of FSByte.

func IsDirectoryErr added in v1.11.2

func IsDirectoryErr(err error) bool

func IsDirectoryError

func IsDirectoryError(err error) bool

func IsHardStop

func IsHardStop(err error) bool

func IsSameMount added in v1.14.6

func IsSameMount(first Mount, second Mount) bool

func MinNonZero

func MinNonZero(data stats.Float64Data) (float64, error)

func MultiReadCloser added in v1.10.7

func MultiReadCloser(readers ...io.Reader) *multiReadCloser

func PrettifyHTML

func PrettifyHTML(in string, req *http.Request) (string, error)

func RegisterActionStep added in v1.11.0

func RegisterActionStep(typeName string, performable Performable)

Register a performable step type to the given type name.

func RegisterGlobalFunction added in v1.19.15

func RegisterGlobalFunction(name string, fn interface{})

Register a function that will be available to all template expressions, wherever they appear.

func RegisterLogFormat added in v1.17.0

func RegisterLogFormat(name string, format string)

Registers a new named format for log output

func RegisterPostprocessor

func RegisterPostprocessor(name string, ppfunc PostprocessorFunc)

func RegisterProtocol added in v1.12.1

func RegisterProtocol(scheme string, protocol Protocol)

Register a new protocol handler that will handle URLs with the given scheme.

func RegisterRenderer added in v1.13.11

func RegisterRenderer(name string, renderer Renderer)

func ShouldEvalInline added in v1.20.7

func ShouldEvalInline(input interface{}, data map[string]interface{}, funcs FuncMap) typeutil.Variant

func TrimEmptyLines

func TrimEmptyLines(in string, req *http.Request) (string, error)

Types

type Action added in v1.11.0

type Action struct {
	Name   string        `yaml:"name,omitempty" json:"name,omitempty"` // The name of this action
	Path   string        `yaml:"path"           json:"path"`           // The URL path this action is accessible from
	Method interface{}   `yaml:"method"         json:"method"`         // The HTTP method(s) this action will respond to
	Steps  []*StepConfig `yaml:"steps"          json:"steps"`          // The list of steps that are applied, in order, to the request body in order to generate a response
}

func (*Action) ServeHTTP added in v1.11.0

func (self *Action) ServeHTTP(w http.ResponseWriter, req *http.Request)

Performs the action in response to an HTTP request, evaluating all action steps. Steps are responsible for generating and manipulating output. The output of the last step will be returned, or an error will be returned if not nil.

type AddHandlerFunc added in v1.12.1

type AddHandlerFunc func(verb string, route string, handler http.HandlerFunc) (string, string, http.HandlerFunc)

type Authenticator

type Authenticator interface {
	Authenticate(http.ResponseWriter, *http.Request) bool
	IsCallback(*url.URL) bool
	Callback(w http.ResponseWriter, req *http.Request)
	Name() string
}

type AuthenticatorConfig

type AuthenticatorConfig struct {
	Name         string                 `yaml:"name,omitempty" json:"name,omitempty"` // The name of the Authenticator
	Type         string                 `yaml:"type"           json:"type"`           // The type of Authenticator to create
	Paths        []string               `yaml:"paths"          json:"paths"`          // Which paths this Authenticator should apply to (defaults to all paths)
	Except       []string               `yaml:"except"         json:"except"`         // Specific paths this Authenticator should not cover (defaults to none)
	CallbackPath string                 `yaml:"callback"       json:"callback"`       // A secondary path this authenticator should redirect to (for multi-step Authenticators)
	Options      map[string]interface{} `yaml:"options"        json:"options"`        // Type-specific options
	// contains filtered or unexported fields
}

func (*AuthenticatorConfig) O added in v1.10.10

func (self *AuthenticatorConfig) O(key string, fallback ...interface{}) typeutil.Variant

type AuthenticatorConfigs

type AuthenticatorConfigs []AuthenticatorConfig

func (AuthenticatorConfigs) Authenticator

func (self AuthenticatorConfigs) Authenticator(req *http.Request) (Authenticator, error)

type BasicAuthenticator

type BasicAuthenticator struct {
	// contains filtered or unexported fields
}

func NewBasicAuthenticator

func NewBasicAuthenticator(config *AuthenticatorConfig) (*BasicAuthenticator, error)

func (*BasicAuthenticator) AddPasswdFile

func (self *BasicAuthenticator) AddPasswdFile(filename string) error

func (*BasicAuthenticator) Authenticate

func (self *BasicAuthenticator) Authenticate(w http.ResponseWriter, req *http.Request) bool

func (*BasicAuthenticator) Callback added in v1.10.10

func (self *BasicAuthenticator) Callback(w http.ResponseWriter, req *http.Request)

func (*BasicAuthenticator) IsCallback added in v1.10.10

func (self *BasicAuthenticator) IsCallback(_ *url.URL) bool

func (*BasicAuthenticator) Name added in v1.11.0

func (self *BasicAuthenticator) Name() string

type Binding

type Binding struct {
	BodyParams         map[string]interface{}        `yaml:"body,omitempty"                 json:"body,omitempty"`                 // If the request receives an open-ended body, this will allow structured data to be passed in.
	DisableCache       bool                          `yaml:"disable_cache,omitempty"        json:"disable_cache,omitempty"`        // Reserved for future use.
	Fallback           interface{}                   `yaml:"fallback,omitempty"             json:"fallback,omitempty"`             // The value to place in $.bindings if the request fails.
	Formatter          string                        `yaml:"formatter,omitempty"            json:"formatter,omitempty"`            // How to serialize BodyParams into a string before the request is made.
	Headers            map[string]string             `yaml:"headers,omitempty"              json:"headers,omitempty"`              // Additional headers to include in the request.
	IfStatus           map[string]BindingErrorAction `yaml:"if_status,omitempty"            json:"if_status,omitempty"`            // Actions to take in response to specific numeric response status codes.
	Insecure           bool                          `yaml:"insecure,omitempty"             json:"insecure,omitempty"`             // If the protocol supports an insecure request mode (e.g.: HTTPS), permit it in this case.
	Method             string                        `yaml:"method,omitempty"               json:"method,omitempty"`               // The protocol-specific method to perform the request with.
	Name               string                        `yaml:"name,omitempty"                 json:"name,omitempty"`                 // The name of the key in the $.bindings template variable.
	NoTemplate         bool                          `yaml:"no_template,omitempty"          json:"no_template,omitempty"`          // Disable templating of variables in this binding.
	NotIfExpr          string                        `yaml:"not_if,omitempty"               json:"not_if,omitempty"`               // Do not evaluate the binding if this expression yields a truthy value.
	OnError            BindingErrorAction            `yaml:"on_error,omitempty"             json:"on_error,omitempty"`             // Actions to take if the request fails.
	OnlyIfExpr         string                        `yaml:"only_if,omitempty"              json:"only_if,omitempty"`              // Only evaluate the binding if this expression yields a truthy value.
	Optional           bool                          `yaml:"optional,omitempty"             json:"optional,omitempty"`             // Whether the request failing will cause a page-wide error or be ignored.
	Paginate           *PaginatorConfig              `yaml:"paginate,omitempty"             json:"paginate,omitempty"`             // A specialized repeater configuration that automatically performs pagination on an upstream request, aggregating the results before returning them.
	ParamJoiner        string                        `yaml:"param_joiner,omitempty"         json:"param_joiner,omitempty"`         // If a parameter is provided as an array, but must be a string in the request, how shall the array elements be joined.
	Params             map[string]interface{}        `yaml:"params,omitempty"               json:"params,omitempty"`               // A set of additional parameters to include in the request (e.g.: HTTP query string parameters)
	Parser             string                        `yaml:"parser,omitempty"               json:"parser,omitempty"`               // How to parse the response content from the request.
	ProtocolOptions    map[string]interface{}        `yaml:"protocol,omitempty"             json:"protocol,omitempty"`             // An open-ended set of options that are available for protocol implementations to use.
	RawBody            string                        `yaml:"rawbody,omitempty"              json:"rawbody,omitempty"`              // If the request receives an open-ended body, this will allow raw data to be passed in as-is.
	Repeat             string                        `yaml:"repeat,omitempty"               json:"repeat,omitempty"`               // A templated value that yields an array.  The binding request will be performed once for each array element, wherein the Resource value is passed into a template that includes the $index and $item variables, which represent the repeat array item's position and value, respectively.
	Resource           string                        `yaml:"resource,omitempty"             json:"resource,omitempty"`             // The URL that specifies the protocol and resource to retrieve.
	SkipInheritHeaders bool                          `yaml:"skip_inherit_headers,omitempty" json:"skip_inherit_headers,omitempty"` // Do not passthrough the headers that were sent to the template from the client's browser, even if Passthrough mode is enabled.
	Timeout            interface{}                   `yaml:"timeout,omitempty"              json:"timeout,omitempty"`              // A duration specifying the timeout for the request.
	Transform          string                        `yaml:"transform,omitempty"            json:"transform,omitempty"`            // Specifies a JSONPath expression that can be used to transform the response data received from the binding into the data that is provided to the template.
	TlsCertificate     string                        `yaml:"tlscrt,omitempty"               json:"tlscrt,omitempty"`               // Provide the path to a TLS client certificate to present if the server requests one.
	TlsKey             string                        `yaml:"tlskey,omitempty"               json:"tlskey,omitempty"`               // Provide the path to a TLS client certificate key to present if the server requests one.
	OnlyPaths          []string                      `yaml:"only,omitempty"                 json:"only,omitempty"`                 // A list of request paths and glob patterns, ANY of which the binding will evaluate on.
	ExceptPaths        []string                      `yaml:"except,omitempty"               json:"except,omitempty"`               // A list of request paths and glob patterns, ANY of which the binding will NOT evaluate on.
	Interval           string                        `yaml:"interval,omitempty"             json:"interval,omitempty"`             // For Async Bindings, this specifies the interval on which data sources should be refreshed (if so desired).
	Restrict           interface{}                   `yaml:"restrict,omitempty"             json:"restrict,omitempty"`             // DEPRECATED: use OnlyPaths/ExceptPaths instead.
	// contains filtered or unexported fields
}

func (*Binding) Evaluate

func (self *Binding) Evaluate(req *http.Request, header *TemplateHeader, data map[string]interface{}, funcs FuncMap) (interface{}, error)

type BindingErrorAction

type BindingErrorAction string

type CSRF added in v1.15.19

type CSRF struct {
	Enable                  bool     `yaml:"enable"                  json:"enable"`                  // Whether to enable stateless CSRF protection
	Except                  []string `yaml:"except"                  json:"except"`                  // A list of paths and path globs that should not be covered by CSRF protection
	Cookie                  *Cookie  `yaml:"cookie"                  json:"cookie"`                  // Specify default fields for the CSRF cookie that is set
	HeaderName              string   `yaml:"header"                  json:"header"`                  // The name of the HTTP header that CSRF tokens may be present in (default: X-CSRF-Token)
	FormFieldName           string   `yaml:"field"                   json:"field"`                   // The name of the HTML form fieldthat CSRF tokens may be present in (default: csrf_token)
	InjectFormFields        bool     `yaml:"injectFormFields"        json:"injectFormFields"`        // If true, a postprocessor will be added that injects a hidden <input> field into all <form> elements returned from Diecast
	InjectFormFieldSelector string   `yaml:"injectFormFieldSelector" json:"injectFormFieldSelector"` // A CSS selector used to locate <form> tags that need the CSRF <input> field injected.
	InjectFormFieldTemplate string   `yaml:"injectFormFieldTemplate" json:"injectFormFieldTemplate"` // Specify the format string that will be used to replace </form> tags with the injected field.
	InjectableMediaTypes    []string `yaml:"injectableMediaTypes"    json:"injectableMediaTypes"`    // Specify a list of Media Types (e.g.: MIME or Content-Types) that will have injection attempted on them (if enabled)
	// contains filtered or unexported fields
}

func (*CSRF) GetCookieName added in v1.16.1

func (self *CSRF) GetCookieName() string

func (*CSRF) GetFormFieldName added in v1.16.1

func (self *CSRF) GetFormFieldName() string

func (*CSRF) GetHeaderName added in v1.16.1

func (self *CSRF) GetHeaderName() string

func (*CSRF) Handle added in v1.17.0

func (self *CSRF) Handle(w http.ResponseWriter, req *http.Request) bool

func (*CSRF) IsExempt added in v1.15.19

func (self *CSRF) IsExempt(req *http.Request) bool

func (*CSRF) Verify added in v1.16.1

func (self *CSRF) Verify(req *http.Request) bool

Verifies that the token that came in via the CSRF cookie and the one that came in as part of the request headers/body are, in fact, the same.

type Cookie struct {
	Name     string         `yaml:"name,omitempty"     json:"name,omitempty"`
	Value    interface{}    `yaml:"-"                  json:"value,omitempty"`
	Path     string         `yaml:"path,omitempty"     json:"path,omitempty"`
	Domain   string         `yaml:"domain,omitempty"   json:"domain,omitempty"`
	MaxAge   *int           `yaml:"maxAge,omitempty"   json:"maxAge,omitempty"`
	Secure   *bool          `yaml:"secure,omitempty"   json:"secure,omitempty"`
	HttpOnly *bool          `yaml:"httpOnly,omitempty" json:"httpOnly,omitempty"`
	SameSite CookieSameSite `yaml:"sameSite,omitempty" json:"sameSite,omitempty"`
}

type CookieSameSite added in v1.15.19

type CookieSameSite string

func MakeCookieSameSite added in v1.17.9

func MakeCookieSameSite(sameSite http.SameSite) CookieSameSite

func (CookieSameSite) SameSite added in v1.15.19

func (self CookieSameSite) SameSite() http.SameSite

type CsrfMethod added in v1.16.1

type CsrfMethod string
const (
	DoubleSubmitCookie CsrfMethod = `cookie`
	HMAC                          = `hmac`
)

type Engine

type Engine int
const (
	TextEngine Engine = iota
	HtmlEngine
)

func GetEngineForFile

func GetEngineForFile(filename string) Engine

func (Engine) String

func (self Engine) String() string

type FileMount

type FileMount struct {
	MountPoint      string                 `json:"mount"`
	Path            string                 `json:"source"`
	Passthrough     bool                   `json:"passthrough"`
	ResponseHeaders map[string]interface{} `json:"response_headers,omitempty"`
	ResponseCode    int                    `json:"response_code"`
	FileSystem      http.FileSystem        `json:"-"`
}

A FileMount exposes the contents of a given filesystem directory.

func (*FileMount) GetMountPoint

func (self *FileMount) GetMountPoint() string

func (*FileMount) GetTarget added in v1.14.6

func (self *FileMount) GetTarget() string

func (*FileMount) Open

func (self *FileMount) Open(name string) (http.File, error)

func (*FileMount) OpenWithType

func (self *FileMount) OpenWithType(name string, req *http.Request, requestBody io.Reader) (*MountResponse, error)

func (*FileMount) String

func (self *FileMount) String() string

func (*FileMount) WillRespondTo

func (self *FileMount) WillRespondTo(name string, req *http.Request, requestBody io.Reader) bool

type Fragment added in v1.11.0

type Fragment struct {
	Name   string
	Header *TemplateHeader
	Data   []byte
}

type FragmentSet added in v1.11.0

type FragmentSet []*Fragment

func (FragmentSet) DebugOutput added in v1.11.0

func (self FragmentSet) DebugOutput() []byte

func (FragmentSet) Get added in v1.11.0

func (self FragmentSet) Get(name string) (*Fragment, bool)

func (FragmentSet) HasLayout added in v1.11.0

func (self FragmentSet) HasLayout() bool

func (FragmentSet) Header added in v1.11.0

func (self FragmentSet) Header(server *Server) TemplateHeader

func (*FragmentSet) OverrideData added in v1.20.3

func (self *FragmentSet) OverrideData(name string, data []byte)

func (*FragmentSet) Parse added in v1.11.0

func (self *FragmentSet) Parse(name string, source io.Reader) error

func (*FragmentSet) Set added in v1.11.0

func (self *FragmentSet) Set(name string, header *TemplateHeader, data []byte) error

type FuncMap

type FuncMap map[string]interface{}

func GetFunctions added in v1.10.7

func GetFunctions(server *Server) (funcGroups, FuncMap)

func GetStandardFunctions

func GetStandardFunctions(server *Server) FuncMap

type HttpProtocol added in v1.11.3

type HttpProtocol struct {
}

The HTTP binding protocol is used to interact with web servers and RESTful APIs. It is specified with URLs that use the http:// or https:// schemes.

func (*HttpProtocol) Retrieve added in v1.11.3

func (self *HttpProtocol) Retrieve(rr *ProtocolRequest) (*ProtocolResponse, error)

type JWTConfig added in v1.20.7

type JWTConfig struct {
	Algorithm string                 `yaml:"alg"     json:"alg"`     // The JWT signing algorithm to use (default: HS256)
	Secret    string                 `yaml:"secret"  json:"secret"`  // The JWT secret used to sign payloads
	Claims    map[string]interface{} `yaml:"claims"  json:"claims"`  // The claims being made (i.e.: the payload that will be converted to JSON)
	Expires   interface{}            `yaml:"expires" json:"expires"` // A duration string representing how long issued tokens will be valid for (default: 60s)
	Issuer    string                 `yaml:"issuer"  json:"issuer"`  // The JWT issuer
	Subject   string                 `yaml:"subject" json:"subject"`
}

func (*JWTConfig) Issue added in v1.20.7

func (self *JWTConfig) Issue(tpldata map[string]interface{}, funcs FuncMap) (string, error)

func (*JWTConfig) SignedString added in v1.20.8

func (self *JWTConfig) SignedString(input string) (string, error)

type JaegerConfig added in v1.18.2

type JaegerConfig struct {
	Enable                  bool                   `yaml:"enable"                  json:"enable"`                  // Explicitly enable or disable Jaeger tracing
	ServiceName             string                 `yaml:"service"                 json:"service"`                 // Set the service name that traces will fall under.
	Agent                   string                 `yaml:"agent"                   json:"agent"`                   // Specify the host:port of a local UDP agent to send traces to.
	Collector               string                 `yaml:"collector"               json:"collector"`               // Specify the collector address to sent traces to.  Overrides "agent" if set.
	Username                string                 `yaml:"username"                json:"username"`                // Provides a username to authenticate with the collector.
	Password                string                 `yaml:"password"                json:"password"`                // Provides a password to authenticate with the collector.
	QueueSize               int                    `yaml:"queueSize"               json:"queueSize"`               // Specify the size of the queue for outgoing reports.
	FlushInterval           string                 `yaml:"flushInterval"           json:"flushInterval"`           // Duration specifying how frequently queued reports should be flushed.
	Tags                    map[string]interface{} `yaml:"tags"                    json:"tags"`                    // A set of key-value pairs that are included in every trace.
	SamplingType            string                 `yaml:"sampling"                json:"sampling"`                // Specifies the type of sampling to use: const, probabilistic, rateLimiting, or remote.
	SamplingParam           float64                `yaml:"samplingParam"           json:"samplingParam"`           // A type-specific parameter used to configure that type of sampling; const: 0 or 1, probabilistic: 0.0-1.0, rateLimiting: max number of spans per seconds, remote: same as probabilistic.
	SamplingServerURL       string                 `yaml:"samplingUrl"             json:"samplingUrl"`             // The sampling server URL for the "remote" sampling type.
	SamplingRefreshInterval string                 `yaml:"samplingRefreshInterval" json:"samplingRefreshInterval"` // How frequently to poll the remote sampling server.
	SamplingMaxOperations   int                    `yaml:"samplingMaxOps"          json:"samplingMaxOps"`          // A maximum number of operations for certain sampling modes.
	OperationsMappings      []*TraceMapping        `yaml:"operations"              json:"operations"`              // Maps regular expressions used to match specific routes to the operation name that will be emitted in traces. Without a matching expression, traces will be named by the calling HTTP method and Request URI.  The string being tested by these regular expressions is the one that would be emitted otherwise; so "GET /path/to/file"
}

type KV added in v1.17.12

type KV struct {
	K string      `json:"key"`
	V interface{} `json:"value"`
}

type LogConfig added in v1.17.0

type LogConfig struct {
	Format      string `yaml:"format"               json:"format"`      // configure the output format for logging requests
	Destination string `yaml:"destination"          json:"destination"` // specify where logs should be written to
	Truncate    bool   `yaml:"truncate"             json:"truncate"`    // if true, the output log file will be truncated on startup
	Colorize    bool   `yaml:"colorize"             json:"colorize"`    // if false, log output will not be colorized
	Disable     bool   `yaml:"disable"              json:"disable"`     // if true, no log output will be written
}

type MarkdownRenderer added in v1.9.20

type MarkdownRenderer struct {
	// contains filtered or unexported fields
}

func (*MarkdownRenderer) Render added in v1.9.20

func (self *MarkdownRenderer) Render(w http.ResponseWriter, req *http.Request, options RenderOptions) error

func (*MarkdownRenderer) SetPrewriteFunc added in v1.11.0

func (self *MarkdownRenderer) SetPrewriteFunc(fn PrewriteFunc)

func (*MarkdownRenderer) SetServer added in v1.13.11

func (self *MarkdownRenderer) SetServer(server *Server)

func (*MarkdownRenderer) ShouldPrerender added in v1.9.22

func (self *MarkdownRenderer) ShouldPrerender() bool

type Middleware added in v1.17.0

type Middleware func(w http.ResponseWriter, req *http.Request) bool

A function that receives the current request, ResponseWriter, and returns whether to call the next middleware in the stack (true) or to stop processing the request immediately (false).

type Mount

type Mount interface {
	Open(string) (http.File, error)
	OpenWithType(string, *http.Request, io.Reader) (*MountResponse, error)
	WillRespondTo(string, *http.Request, io.Reader) bool
	GetMountPoint() string
	GetTarget() string
}

func NewMountFromSpec

func NewMountFromSpec(spec string) (Mount, error)

type MountConfig

type MountConfig struct {
	Mount   string                 `yaml:"mount"   json:"mount"`   // The URL path that this mount will respond to
	To      string                 `yaml:"to"      json:"to"`      // The upstream URL or local filesystem path that will serve this path
	Options map[string]interface{} `yaml:"options" json:"options"` // Mount-specific options
}

type MountResponse

type MountResponse struct {
	ContentType  string
	StatusCode   int
	Metadata     map[string]interface{}
	RedirectTo   string
	RedirectCode int
	// contains filtered or unexported fields
}

func NewMountResponse

func NewMountResponse(name string, size int64, payload interface{}) *MountResponse

func (*MountResponse) Close

func (self *MountResponse) Close() error

func (*MountResponse) GetFile

func (self *MountResponse) GetFile() http.File

func (*MountResponse) GetPayload

func (self *MountResponse) GetPayload() interface{}

func (*MountResponse) IsDir

func (self *MountResponse) IsDir() bool

func (*MountResponse) ModTime

func (self *MountResponse) ModTime() time.Time

func (*MountResponse) Mode

func (self *MountResponse) Mode() os.FileMode

func (*MountResponse) Name

func (self *MountResponse) Name() string

func (*MountResponse) Read

func (self *MountResponse) Read(p []byte) (int, error)

func (*MountResponse) Readdir

func (self *MountResponse) Readdir(count int) ([]os.FileInfo, error)

func (*MountResponse) Seek

func (self *MountResponse) Seek(offset int64, whence int) (int64, error)

func (*MountResponse) Size

func (self *MountResponse) Size() int64

func (*MountResponse) Stat

func (self *MountResponse) Stat() (os.FileInfo, error)

func (*MountResponse) Sys

func (self *MountResponse) Sys() interface{}

type OOXMLRenderer added in v1.20.3

type OOXMLRenderer struct {
	// contains filtered or unexported fields
}

func (*OOXMLRenderer) Render added in v1.20.3

func (self *OOXMLRenderer) Render(w http.ResponseWriter, req *http.Request, options RenderOptions) error

func (*OOXMLRenderer) SetPrewriteFunc added in v1.20.3

func (self *OOXMLRenderer) SetPrewriteFunc(fn PrewriteFunc)

func (*OOXMLRenderer) SetServer added in v1.20.3

func (self *OOXMLRenderer) SetServer(server *Server)

func (*OOXMLRenderer) ShouldPrerender added in v1.20.3

func (self *OOXMLRenderer) ShouldPrerender() bool

type OauthAuthenticator added in v1.10.10

type OauthAuthenticator struct {
	// contains filtered or unexported fields
}

func NewOauthAuthenticator added in v1.10.10

func NewOauthAuthenticator(config *AuthenticatorConfig) (*OauthAuthenticator, error)

func (*OauthAuthenticator) Authenticate added in v1.10.10

func (self *OauthAuthenticator) Authenticate(w http.ResponseWriter, req *http.Request) bool

func (*OauthAuthenticator) Callback added in v1.10.10

func (self *OauthAuthenticator) Callback(w http.ResponseWriter, req *http.Request)

OAuth2: Leg 2: receive callback from consent page, validate session, and set session cookie

func (*OauthAuthenticator) IsCallback added in v1.10.10

func (self *OauthAuthenticator) IsCallback(u *url.URL) bool

func (*OauthAuthenticator) Name added in v1.11.0

func (self *OauthAuthenticator) Name() string

type PaginatorConfig added in v1.12.12

type PaginatorConfig struct {
	Total        string            `yaml:"total"   json:"total"`
	Count        string            `yaml:"count"   json:"count"`
	Done         string            `yaml:"done"    json:"done"`
	Maximum      int64             `yaml:"max"     json:"max"`
	Data         string            `yaml:"data"    json:"data"`
	QueryStrings map[string]string `yaml:"params"  json:"params"`
	Headers      map[string]string `yaml:"headers" json:"headers"`
}

type PdfRenderer added in v1.9.20

type PdfRenderer struct {
	// contains filtered or unexported fields
}

func (*PdfRenderer) Render added in v1.9.20

func (self *PdfRenderer) Render(w http.ResponseWriter, req *http.Request, options RenderOptions) error

func (*PdfRenderer) SetPrewriteFunc added in v1.11.0

func (self *PdfRenderer) SetPrewriteFunc(fn PrewriteFunc)

func (*PdfRenderer) SetServer added in v1.13.11

func (self *PdfRenderer) SetServer(server *Server)

func (*PdfRenderer) ShouldPrerender added in v1.9.22

func (self *PdfRenderer) ShouldPrerender() bool

type Performable added in v1.11.0

type Performable interface {
	Perform(config *StepConfig, w http.ResponseWriter, req *http.Request, prev *StepConfig) (interface{}, error)
}

type PostprocessorFunc

type PostprocessorFunc func(string, *http.Request) (string, error)

type PrewriteFunc added in v1.11.0

type PrewriteFunc func(*http.Request)

type ProcessStep added in v1.11.0

type ProcessStep struct{}

[type=process] Process the output of the previous step by performing a sequence of discrete

operations on the data.

-------------------------------------------------------------------------------------------------

func (*ProcessStep) Perform added in v1.11.0

func (self *ProcessStep) Perform(config *StepConfig, w http.ResponseWriter, req *http.Request, prev *StepConfig) (interface{}, error)

type Protocol added in v1.11.3

type Protocol interface {
	Retrieve(*ProtocolRequest) (*ProtocolResponse, error)
}

type ProtocolConfig added in v1.11.3

type ProtocolConfig map[string]interface{}

func (ProtocolConfig) Get added in v1.11.3

func (self ProtocolConfig) Get(key string, fallbacks ...interface{}) typeutil.Variant

type ProtocolRequest added in v1.11.3

type ProtocolRequest struct {
	Verb              string
	URL               *url.URL
	Binding           *Binding
	Request           *http.Request
	Header            *TemplateHeader
	TemplateData      map[string]interface{}
	TemplateFuncs     FuncMap
	DefaultTimeout    time.Duration
	AdditionalHeaders map[string]interface{}
}

func (*ProtocolRequest) Conf added in v1.11.3

func (self *ProtocolRequest) Conf(proto string, key string, fallbacks ...interface{}) typeutil.Variant

func (*ProtocolRequest) ReadFile added in v1.15.1

func (self *ProtocolRequest) ReadFile(filename string) ([]byte, error)

func (*ProtocolRequest) Template added in v1.11.3

func (self *ProtocolRequest) Template(input interface{}) (typeutil.Variant, error)

type ProtocolResponse added in v1.11.3

type ProtocolResponse struct {
	MimeType   string
	StatusCode int
	Raw        interface{}
	// contains filtered or unexported fields
}

func NewProtocolResponse added in v1.19.11

func NewProtocolResponse(data io.ReadCloser) *ProtocolResponse

func (*ProtocolResponse) Close added in v1.11.3

func (self *ProtocolResponse) Close() error

func (*ProtocolResponse) PeekLen added in v1.12.4

func (self *ProtocolResponse) PeekLen() (int64, error)

func (*ProtocolResponse) Read added in v1.11.3

func (self *ProtocolResponse) Read(b []byte) (int, error)

type ProxyMount

type ProxyMount struct {
	MountPoint              string                 `json:"-"`
	URL                     string                 `json:"-"`
	Method                  string                 `json:"method,omitempty"`
	Headers                 map[string]interface{} `json:"headers,omitempty"`
	ResponseHeaders         map[string]interface{} `json:"response_headers,omitempty"`
	ResponseCode            int                    `json:"response_code"`
	RedirectOnSuccess       string                 `json:"redirect_on_success"`
	Params                  map[string]interface{} `json:"params,omitempty"`
	Timeout                 interface{}            `json:"timeout,omitempty"`
	PassthroughRequests     bool                   `json:"passthrough_requests"`
	PassthroughHeaders      bool                   `json:"passthrough_headers"`
	PassthroughQueryStrings bool                   `json:"passthrough_query_strings"`
	PassthroughBody         bool                   `json:"passthrough_body"`
	PassthroughErrors       bool                   `json:"passthrough_errors"`
	PassthroughRedirects    bool                   `json:"passthrough_redirects"`
	PassthroughUserAgent    bool                   `json:"passthrough_user_agent"`
	StripPathPrefix         string                 `json:"strip_path_prefix"`
	AppendPathPrefix        string                 `json:"append_path_prefix"`
	Insecure                bool                   `json:"insecure"`
	BodyBufferSize          int64                  `json:"body_buffer_size"`
	CloseConnection         *bool                  `json:"close_connection"`
	Client                  *http.Client
	// contains filtered or unexported fields
}

func (*ProxyMount) GetMountPoint

func (self *ProxyMount) GetMountPoint() string

func (*ProxyMount) GetTarget added in v1.14.6

func (self *ProxyMount) GetTarget() string

func (*ProxyMount) Open

func (self *ProxyMount) Open(name string) (http.File, error)

func (*ProxyMount) OpenWithType

func (self *ProxyMount) OpenWithType(name string, req *http.Request, requestBody io.Reader) (res *MountResponse, err error)

func (*ProxyMount) String

func (self *ProxyMount) String() string

func (*ProxyMount) WillRespondTo

func (self *ProxyMount) WillRespondTo(name string, req *http.Request, requestBody io.Reader) bool

type RateLimitConfig added in v1.17.23

type RateLimitConfig struct {
	Enable    bool   `yaml:"enable"     json:"enable"`
	Limit     string `yaml:"limit"      json:"limit"`      // Specify a rate limit string (e.g.: "1r/s", "200r/m")
	PerClient bool   `yaml:"per_client" json:"per_client"` // Specify that the limit should be applied per-client instead of globally.
	Penalty   string `yaml:"penalty"    json:"penalty"`    // An amount of time to sleep instead of returning an HTTP 429 error on rate limited requests
}

func (*RateLimitConfig) KeyFor added in v1.17.23

func (self *RateLimitConfig) KeyFor(req *http.Request) string

type Redirect

type Redirect struct {
	URL  string `yaml:"url"  json:"url"`
	Code int    `yaml:"code" json:"code"`
}

type RedirectTo

type RedirectTo string

func (RedirectTo) Error

func (self RedirectTo) Error() string

type RedisProtocol added in v1.11.3

type RedisProtocol struct {
}

The Redis binding protocol is used to retrieve or modify items in a Redis server. It is specified with URLs that use the redis://[host[:port]]/db/key scheme.

Protocol Options

  • redis.default_host (localhost:6379) Specifies the hostname:port to use if a resource URI does not specify one.
  • redis.max_idle (10) The maximum number of idle connections to maintain in a connection pool.
  • redis.idle_timeout (120s) The maximum idle time of a connection before it is closed.
  • redis.max_lifetime (10m) The maximum amount of time a connection can remain open before being recycled.

func (*RedisProtocol) Retrieve added in v1.11.3

func (self *RedisProtocol) Retrieve(rr *ProtocolRequest) (*ProtocolResponse, error)

type RenderOptions added in v1.9.20

type RenderOptions struct {
	Header        *TemplateHeader
	HeaderOffset  int
	FunctionSet   FuncMap
	Input         io.ReadCloser
	Fragments     FragmentSet
	Data          map[string]interface{}
	MimeType      string
	RequestedPath string
	Timeout       time.Duration
}

type Renderer added in v1.9.20

type Renderer interface {
	SetPrewriteFunc(PrewriteFunc)
	SetServer(*Server)
	Render(w http.ResponseWriter, req *http.Request, options RenderOptions) error
	ShouldPrerender() bool
}

func GetRenderer added in v1.9.20

func GetRenderer(name string, server *Server) (Renderer, error)

func GetRendererForFilename added in v1.9.20

func GetRendererForFilename(filename string, server *Server) (Renderer, bool)

type RequestAuthenticator added in v1.17.1

type RequestAuthenticator struct {
	// contains filtered or unexported fields
}

func NewRequestAuthenticator added in v1.17.1

func NewRequestAuthenticator(config *AuthenticatorConfig) (*RequestAuthenticator, error)

func (*RequestAuthenticator) Authenticate added in v1.17.1

func (self *RequestAuthenticator) Authenticate(w http.ResponseWriter, req *http.Request) bool

func (*RequestAuthenticator) Callback added in v1.17.1

func (self *RequestAuthenticator) Callback(w http.ResponseWriter, req *http.Request)

func (*RequestAuthenticator) IsCallback added in v1.17.1

func (self *RequestAuthenticator) IsCallback(_ *url.URL) bool

func (*RequestAuthenticator) Name added in v1.17.1

func (self *RequestAuthenticator) Name() string

type RequestBody added in v1.20.5

type RequestBody struct {
	Length   int64         `json:"size"`
	Raw      []byte        `json:"raw"`
	String   string        `json:"string"`
	Parsed   interface{}   `json:"parsed"`
	Error    string        `json:"error,omitempty"`
	Loaded   bool          `json:"loaded,omitempty"`
	Original io.ReadCloser `json:"-"`
	// contains filtered or unexported fields
}

func (*RequestBody) Close added in v1.20.5

func (self *RequestBody) Close() error

func (*RequestBody) Read added in v1.20.5

func (self *RequestBody) Read(b []byte) (int, error)

type RequestInfo added in v1.17.9

type RequestInfo struct {
	ID               string                 `json:"id"`
	Timestamp        int64                  `json:"timestamp"`
	Method           string                 `json:"method"`
	Protocol         string                 `json:"protocol"`
	ContentLength    int64                  `json:"length"`
	TransferEncoding []string               `json:"encoding"`
	Headers          map[string]interface{} `json:"headers"`
	Cookies          map[string]Cookie      `json:"cookies"`
	RemoteIP         string                 `json:"remote_ip"`
	RemotePort       int                    `json:"remote_port"`
	RemoteAddr       string                 `json:"remote_address"`
	Host             string                 `json:"host"`
	URL              RequestUrlInfo         `json:"url"`
	TLS              *RequestTlsInfo        `json:"tls"`
	CSRFToken        string                 `json:"csrftoken,omitempty"`
	Body             *RequestBody           `json:"body,omitempty"`
}

func (*RequestInfo) Cookie added in v1.17.20

func (self *RequestInfo) Cookie(key string) *Cookie

func (*RequestInfo) Header added in v1.17.20

func (self *RequestInfo) Header(key string) typeutil.Variant

type RequestTlsCertInfo added in v1.17.9

type RequestTlsCertInfo struct {
	Issuer                 RequestTlsCertName `json:"issuer"`
	Subject                RequestTlsCertName `json:"subject"`
	NotBefore              time.Time          `json:"not_before"`
	NotAfter               time.Time          `json:"not_after"`
	SecondsLeft            int                `json:"seconds_left"`
	OcspServer             []string           `json:"ocsp_server"`
	IssuingCertUrl         []string           `json:"issuing_cert_url"`
	Version                int                `json:"version"`
	SerialNumber           string             `json:"serialnumber"`
	SubjectAlternativeName *RequestTlsCertSan `json:"san"`
}

type RequestTlsCertName added in v1.17.9

type RequestTlsCertName struct {
	SerialNumber       string `json:"serialnumber"`
	CommonName         string `json:"common"`
	Country            string `json:"country"`
	Organization       string `json:"organization"`
	OrganizationalUnit string `json:"orgunit"`
	Locality           string `json:"locality"`
	State              string `json:"state"`
	StreetAddress      string `json:"street"`
	PostalCode         string `json:"postalcode"`
}

type RequestTlsCertSan added in v1.17.9

type RequestTlsCertSan struct {
	DNSNames       []string `json:"dns"`
	EmailAddresses []string `json:"email"`
	IPAddresses    []string `json:"ip"`
	URIs           []string `json:"uri"`
}

type RequestTlsInfo added in v1.17.9

type RequestTlsInfo struct {
	Version                    string               `json:"version"`
	HandshakeComplete          bool                 `json:"handshake_complete"`
	DidResume                  bool                 `json:"did_resume"`
	CipherSuite                string               `json:"cipher_suite"`
	NegotiatedProtocol         string               `json:"negotiated_protocol"`
	NegotiatedProtocolIsMutual bool                 `json:"negotiated_protocol_is_mutual"`
	ServerName                 string               `json:"server_name"`
	TlsUnique                  []byte               `json:"tls_unique"`
	Client                     RequestTlsCertInfo   `json:"client"`
	ClientChain                []RequestTlsCertInfo `json:"client_chain"`
}

type RequestUrlInfo added in v1.17.9

type RequestUrlInfo struct {
	Unmodified string                 `json:"unmodified"`
	String     string                 `json:"string"`
	Scheme     string                 `json:"scheme"`
	Host       string                 `json:"host"`
	Port       int                    `json:"port"`
	Path       string                 `json:"path"`
	Fragment   string                 `json:"fragment"`
	Query      map[string]interface{} `json:"query"`
	Params     []KV                   `json:"params"`
}

func (RequestUrlInfo) ParamsSlice added in v1.17.20

func (self RequestUrlInfo) ParamsSlice() []interface{}

type RespondStep added in v1.12.9

type RespondStep struct{}

[type=respond] Configure the HTTP response headers and status. -------------------------------------------------------------------------------------------------

func (*RespondStep) Perform added in v1.12.9

func (self *RespondStep) Perform(config *StepConfig, w http.ResponseWriter, req *http.Request, prev *StepConfig) (interface{}, error)

type ResultsPage added in v1.12.12

type ResultsPage struct {
	Page    int         `yaml:"page"           json:"page"`
	Last    bool        `yaml:"last,omitempty" json:"last,omitempty"`
	Range   []int64     `yaml:"range"          json:"range"`
	Data    interface{} `yaml:"data"           json:"data"`
	Counter int64       `yaml:"counter"        json:"counter"`
	Total   int64       `yaml:"total"          json:"total"`
}

type Routable added in v1.16.6

type Routable interface {
	P(req *http.Request, param string, fallback ...interface{}) typeutil.Variant
	Get(route string, handler http.HandlerFunc)
	Websocket(route string, wsHandler WebsocketHandlerFunc, upgradeHeaders http.Header)
	Head(route string, handler http.HandlerFunc)
	Post(route string, handler http.HandlerFunc)
	Put(route string, handler http.HandlerFunc)
	Delete(route string, handler http.HandlerFunc)
	Patch(route string, handler http.HandlerFunc)
	Options(route string, handler http.HandlerFunc)
	Connect(route string, handler http.HandlerFunc)
	Trace(route string, handler http.HandlerFunc)
	HandleFunc(route string, handler http.HandlerFunc)
	Handle(route string, handler http.Handler)
}

type S3Mount added in v1.19.0

type S3Mount struct {
	MountPoint string `json:"mount"`
	Path       string `json:"source"`
	// contains filtered or unexported fields
}

A S3Mount exposes the contents of a given filesystem directory. As is tradition with AWS client software, this package recongnizes and will honor several environment variable values for specifying configuration details to the client. These variables include:

- `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` representing the credentials to authenticate with - `AWS_REGION` to specify the region name - `AWS_PROFILE` to specify the named profile to utilize when reading from ~/.aws/credentials and ~/.aws/config - `AWS_ENDPOINT_URL` to override the HTTPS endpoint to use, namely for pointing to S3-compatible services.

func (*S3Mount) GetMountPoint added in v1.19.0

func (self *S3Mount) GetMountPoint() string

func (*S3Mount) GetTarget added in v1.19.0

func (self *S3Mount) GetTarget() string

func (*S3Mount) Open added in v1.19.0

func (self *S3Mount) Open(name string) (http.File, error)

func (*S3Mount) OpenWithType added in v1.19.0

func (self *S3Mount) OpenWithType(name string, req *http.Request, requestBody io.Reader) (*MountResponse, error)

func (*S3Mount) String added in v1.19.0

func (self *S3Mount) String() string

func (*S3Mount) WillRespondTo added in v1.19.0

func (self *S3Mount) WillRespondTo(name string, req *http.Request, requestBody io.Reader) bool

type SassRenderer added in v1.10.3

type SassRenderer struct {
	// contains filtered or unexported fields
}

func (*SassRenderer) Render added in v1.10.3

func (self *SassRenderer) Render(w http.ResponseWriter, req *http.Request, options RenderOptions) error

func (*SassRenderer) SetPrewriteFunc added in v1.11.0

func (self *SassRenderer) SetPrewriteFunc(fn PrewriteFunc)

func (*SassRenderer) SetServer added in v1.13.11

func (self *SassRenderer) SetServer(server *Server)

func (*SassRenderer) ShouldPrerender added in v1.10.3

func (self *SassRenderer) ShouldPrerender() bool

type ServeFunc added in v1.17.8

type ServeFunc func(*Server) error

type Serveable added in v1.17.0

type Serveable interface {
	ListenAndServe() error
	ListenAndServeTLS(string, string) error
	Serve(net.Listener) error
	ServeTLS(net.Listener, string, string) error
}

type Server

type Server struct {
	Actions              []*Action                 `yaml:"actions"                 json:"actions"`                 // Configure routes and actions to execute when those routes are requested.
	AdditionalFunctions  template.FuncMap          `yaml:"-"                       json:"-"`                       // Allow for the programmatic addition of extra functions for use in templates.
	Address              string                    `yaml:"address"                 json:"address"`                 // The host:port address the server is listening on
	Authenticators       AuthenticatorConfigs      `yaml:"authenticators"          json:"authenticators"`          // A set of authenticator configurations used to protect some or all routes.
	Autoindex            bool                      `yaml:"autoindex"               json:"autoindex"`               // Specify that requests that terminate at a filesystem directory should automatically generate an index listing of that directory.
	AutoindexTemplate    string                    `yaml:"autoindexTemplate"       json:"autoindexTemplate"`       // If Autoindex is enabled, this allows the template used to generate the index page to be customized.
	AutolayoutPatterns   []string                  `yaml:"autolayoutPatterns"      json:"autolayoutPatterns"`      // Which types of files will automatically have layouts applied.
	BaseHeader           *TemplateHeader           `yaml:"header"                  json:"header"`                  // A default header that all templates will inherit from.
	BinPath              string                    `yaml:"-"                       json:"-"`                       // Exposes the location of the diecast binary
	BindingPrefix        string                    `yaml:"bindingPrefix"           json:"bindingPrefix"`           // Specify a string to prefix all binding resource values that start with "/"
	Bindings             SharedBindingSet          `yaml:"bindings"                json:"bindings"`                // Top-level bindings that apply to every rendered template
	DefaultPageObject    map[string]interface{}    `yaml:"-"                       json:"-"`                       //
	DisableCommands      bool                      `yaml:"disable_commands"        json:"disable_commands"`        // Disable the execution of PrestartCommands and StartCommand .
	DisableTimings       bool                      `yaml:"disableTimings"          json:"disableTimings"`          // Disable emitting per-request Server-Timing headers to aid in tracing bottlenecks and performance issues.
	EnableDebugging      bool                      `yaml:"debug"                   json:"debug"`                   // Enables additional options for debugging applications. Caution: can expose secrets and other sensitive data.
	DebugDumpRequests    map[string]string         `yaml:"debugDumpRequests"       json:"debugDumpRequests"`       // An object keyed on path globs whose values are a directory where matching requests are dumped in their entirety as text files.
	EnableLayouts        bool                      `yaml:"enableLayouts"           json:"enableLayouts"`           // Specifies whether layouts are enabled
	Environment          string                    `yaml:"environment"             json:"environment"`             // Specify the environment for loading environment-specific configuration files in the form "diecast.env.yml"
	ErrorsPath           string                    `yaml:"errors"                  json:"errors"`                  // The path to the errors template directory
	ExposeEnvVars        []string                  `yaml:"exposeEnvVars"           json:"exposeEnvVars"`           // a list of glob patterns matching environment variable names that should always be exposed
	FaviconPath          string                    `yaml:"favicon"                 json:"favicon"`                 // TODO: favicon autogenerator: Specifies the relative path to the file containing the /favicon.ico file.  This path can point to a Windows Icon (.ico), GIF, PNG, JPEG, or Bitmap (.bmp).  If necessary, the file will be converted and stored in memory to the ICO format.
	FilterEnvVars        []string                  `yaml:"filterEnvVars"           json:"filterEnvVars"`           // a list of glob patterns matching environment variable names that should not be exposed
	GlobalHeaders        map[string]interface{}    `yaml:"globalHeaders,omitempty" json:"globalHeaders,omitempty"` // A set of HTTP headers that should be added to EVERY response Diecast returns, regardless of whether it originates from a template, mount, or other configuration.
	IndexFile            string                    `yaml:"indexFile"               json:"indexFile"`               // The name of the template file to use when a directory is requested.
	LayoutPath           string                    `yaml:"layouts"                 json:"layouts"`                 // The path to the layouts template directory
	Locale               string                    `yaml:"locale"                  json:"locale"`                  // Specify the default locale for pages being served.
	MountConfigs         []MountConfig             `yaml:"mounts"                  json:"mounts"`                  // A list of mount configurations read from the diecast.yml config file.
	Mounts               []Mount                   `yaml:"-"                       json:"-"`                       // The set of all registered mounts.
	OnAddHandler         AddHandlerFunc            `yaml:"-"                       json:"-"`                       // A function that can be used to intercept handlers being added to the server.
	OverridePageObject   map[string]interface{}    `yaml:"-"                       json:"-"`                       //
	PrestartCommands     []*StartCommand           `yaml:"prestart"                json:"prestart"`                // A command that will be executed before the server is started.
	Protocols            map[string]ProtocolConfig `yaml:"protocols"               json:"protocols"`               // Setup global configuration details for Binding Protocols
	RendererMappings     map[string]string         `yaml:"rendererMapping"         json:"rendererMapping"`         // Map file extensions to preferred renderers for a given file type.
	RootPath             string                    `yaml:"root"                    json:"root"`                    // The filesystem location where templates and files are served from
	RoutePrefix          string                    `yaml:"routePrefix"             json:"routePrefix"`             // If specified, all requests must be prefixed with this string.
	StartCommands        []*StartCommand           `yaml:"start"                   json:"start"`                   // A command that will be executed after the server is confirmed running.
	TLS                  *TlsConfig                `yaml:"tls"                     json:"tls"`                     // where SSL/TLS configuration is stored
	TemplatePatterns     []string                  `yaml:"patterns"                json:"patterns"`                // A set of glob patterns specifying which files will be rendered as templates.
	Translations         map[string]interface{}    `yaml:"translations,omitempty"  json:"translations,omitempty"`  // Stores translations for use with the i18n and l10n functions.  Keys values represent the
	TrustedRootPEMs      []string                  `yaml:"trustedRootPEMs"         json:"trustedRootPEMs"`         // List of filenames containing PEM-encoded X.509 TLS certificates that represent trusted authorities.  Use to validate certificates signed by an internal, non-public authority.
	TryExtensions        []string                  `yaml:"tryExtensions"           json:"tryExtensions"`           // Try these file extensions when looking for default (i.e.: "index") files.  If IndexFile has an extension, it will be stripped first.
	TryLocalFirst        bool                      `yaml:"localFirst"              json:"localFirst"`              // Whether to attempt to locate a local file matching the requested path before attempting to find a template.
	VerifyFile           string                    `yaml:"verifyFile"              json:"verifyFile"`              // A file that must exist and be readable before starting the server.
	PreserveConnections  bool                      `yaml:"preserveConnections"     json:"preserveConnections"`     // Don't add the "Connection: close" header to every response.
	CSRF                 *CSRF                     `yaml:"csrf"                    json:"csrf"`                    // configures CSRF protection
	Log                  LogConfig                 `yaml:"log"                     json:"log"`                     // configure logging
	BeforeHandlers       []Middleware              `yaml:"-"                       json:"-"`                       // contains a stack of Middleware functions that are run before handling the request
	AfterHandlers        []http.HandlerFunc        `yaml:"-"                       json:"-"`                       // contains a stack of HandlerFuncs that are run after handling the request.  These functions cannot stop the request, as it's already been written to the client.
	Protocol             string                    `yaml:"protocol"                json:"protocol"`                // Specify which HTTP protocol to use ("http", "http2")
	RateLimit            *RateLimitConfig          `yaml:"ratelimit"               json:"ratelimit"`               // Specify a rate limiting configuration.
	BindingTimeout       interface{}               `yaml:"bindingTimeout"          json:"bindingTimeout"`          // Sets the default timeout for bindings that don't explicitly set one.
	JaegerConfig         *JaegerConfig             `yaml:"jaeger"                  json:"jaeger"`                  // Configures distributed tracing using Jaeger.
	AutocompressPatterns []string                  `yaml:"autocompress"            json:"autocompress"`            // A set of glob patterns indicating directories whose contents will be delivered as ZIP files
	RequestBodyPreload   int64                     `yaml:"requestPreload"          json:"requestPreload"`          // Maximum number of bytes to read from a request body for the purpose of automatically parsing it.  Requests larger than this will not be available to templates.
	JWT                  map[string]*JWTConfig     `yaml:"jwt"                     json:"jwt"`                     // Contains configurations for generating JSON Web Tokens in templates.
	// contains filtered or unexported fields
}

func NewServer

func NewServer(root interface{}, patterns ...string) *Server

func (*Server) Connect added in v1.11.7

func (self *Server) Connect(route string, handler http.HandlerFunc)

Add a handler for an HTTP CONNECT endpoint.

func (*Server) Delete added in v1.11.7

func (self *Server) Delete(route string, handler http.HandlerFunc)

Add a handler for an HTTP DELETE endpoint.

func (*Server) Get added in v1.11.7

func (self *Server) Get(route string, handler http.HandlerFunc)

Add a handler for an HTTP GET endpoint.

func (*Server) GetResponse added in v1.19.12

func (self *Server) GetResponse(method string, path string, body io.Reader, params map[string]interface{}, headers map[string]interface{}) *http.Response

Perform a single request to the server and return an http.Response.

func (*Server) GetTemplateData

func (self *Server) GetTemplateData(req *http.Request, header *TemplateHeader) (FuncMap, map[string]interface{}, error)

func (*Server) GetTemplateFunctions

func (self *Server) GetTemplateFunctions(data map[string]interface{}, header *TemplateHeader) FuncMap

Retrieves the set of standard template functions, as well as functions for working with data in the current request.

func (*Server) Handle added in v1.11.7

func (self *Server) Handle(route string, handler http.Handler)

Add a handler function for an endpoint (any HTTP method.)

func (*Server) HandleFunc added in v1.11.7

func (self *Server) HandleFunc(route string, handler http.HandlerFunc)

Add a handler for an endpoint (any HTTP method.)

func (*Server) Head added in v1.11.7

func (self *Server) Head(route string, handler http.HandlerFunc)

Add a handler for an HTTP HEAD endpoint.

func (*Server) Initialize

func (self *Server) Initialize() error

func (*Server) IsInRootPath added in v1.11.2

func (self *Server) IsInRootPath(path string) bool

func (*Server) ListenAndServe

func (self *Server) ListenAndServe(address string) error

func (*Server) LoadConfig

func (self *Server) LoadConfig(filename string) error

func (*Server) LoadConfigFromReader added in v1.19.1

func (self *Server) LoadConfigFromReader(file io.Reader, filename string) error

func (*Server) LoadLayout

func (self *Server) LoadLayout(name string) (io.Reader, error)

func (*Server) LocalURL added in v1.20.21

func (self *Server) LocalURL() string

Return a URL string that can be used to perform requests from the local machine.

func (*Server) Open added in v1.19.16

func (self *Server) Open(name string) (http.File, error)

Read a file from the underlying root filesystem, satisfying the http.FileSystem interface.

func (*Server) Options added in v1.11.7

func (self *Server) Options(route string, handler http.HandlerFunc)

Add a handler for an HTTP OPTIONS endpoint.

func (*Server) P added in v1.11.7

func (self *Server) P(req *http.Request, param string, fallback ...interface{}) typeutil.Variant

Return the value of a URL parameter within a given request handler.

func (*Server) Patch added in v1.11.7

func (self *Server) Patch(route string, handler http.HandlerFunc)

Add a handler for an HTTP PATCH endpoint.

func (*Server) Post added in v1.11.7

func (self *Server) Post(route string, handler http.HandlerFunc)

Add a handler for an HTTP POST endpoint.

func (*Server) Put added in v1.11.7

func (self *Server) Put(route string, handler http.HandlerFunc)

Add a handler for an HTTP PUT endpoint.

func (*Server) RenderPath added in v1.15.15

func (self *Server) RenderPath(w io.Writer, path string) error

Perform an end-to-end render of a single path, writing the output to the given writer, then exit.

func (*Server) RunStartCommand

func (self *Server) RunStartCommand(scmds []*StartCommand, waitForCommand bool) (bool, error)

func (*Server) Serve

func (self *Server) Serve(workers ...ServeFunc) error

Start a long-running webserver. If provided, the functions provided will be run in parallel after the server has started. If any of them return a non-nil error, the server will stop and this method will return that error.

func (*Server) ServeHTTP

func (self *Server) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*Server) SetFileSystem

func (self *Server) SetFileSystem(fs http.FileSystem)

func (*Server) SetMounts

func (self *Server) SetMounts(mounts []Mount)

Append the specified mounts to the current server.

func (*Server) ShouldReturnSource

func (self *Server) ShouldReturnSource(req *http.Request) bool

func (*Server) ToTemplateName

func (self *Server) ToTemplateName(requestPath string) string

func (*Server) Trace added in v1.11.7

func (self *Server) Trace(route string, handler http.HandlerFunc)

Add a handler for an HTTP TRACE endpoint.

func (*Server) Websocket added in v1.20.25

func (self *Server) Websocket(route string, wsHandler WebsocketHandlerFunc, upgradeHeaders http.Header)

type SharedBindingSet added in v1.19.18

type SharedBindingSet []*Binding

type ShellAuthenticator added in v1.11.0

type ShellAuthenticator struct {
	// contains filtered or unexported fields
}

func NewShellAuthenticator added in v1.11.0

func NewShellAuthenticator(config *AuthenticatorConfig) (*ShellAuthenticator, error)

func (*ShellAuthenticator) Authenticate added in v1.11.0

func (self *ShellAuthenticator) Authenticate(w http.ResponseWriter, req *http.Request) bool

func (*ShellAuthenticator) Callback added in v1.11.0

func (self *ShellAuthenticator) Callback(w http.ResponseWriter, req *http.Request)

func (*ShellAuthenticator) IsCallback added in v1.11.0

func (self *ShellAuthenticator) IsCallback(_ *url.URL) bool

func (*ShellAuthenticator) Name added in v1.11.0

func (self *ShellAuthenticator) Name() string

type ShellStep added in v1.11.0

type ShellStep struct{}

[type=shell] Return the output of a command as a response. Valid Configurations

Command string passed to the user's $SHELL:

data: 'some shell command'

Command array executed via exec*() system calls:

data: ['command', '--arg', 'x=1', '--help']

Command options specified as an object:

	data:
		command:   				# interpreted the same as above (string or array)
		inherit: true|false 	# whether the current shell environment should be inherited by the command
     env:
			X: abc
			Y: zyx

-------------------------------------------------------------------------------------------------

func (*ShellStep) Perform added in v1.11.0

func (self *ShellStep) Perform(config *StepConfig, w http.ResponseWriter, req *http.Request, prev *StepConfig) (interface{}, error)

type StartCommand

type StartCommand struct {
	Command          string                 `yaml:"command"          json:"command"`          // The shell command line to execute on start
	Directory        string                 `yaml:"directory"        json:"directory"`        // The working directory the command should be run from
	Environment      map[string]interface{} `yaml:"env"              json:"env"`              // A map of environment variables to expose to the command
	WaitBefore       string                 `yaml:"delay"            json:"delay"`            // How long to delay before running the command
	Wait             string                 `yaml:"timeout"          json:"timeout"`          // How long to wait before killing the command
	ExitOnCompletion bool                   `yaml:"exitOnCompletion" json:"exitOnCompletion"` // Whether Diecast should exit upon command completion
	// contains filtered or unexported fields
}

type StaticAuthenticator added in v1.11.0

type StaticAuthenticator struct {
	// contains filtered or unexported fields
}

func NewStaticAuthenticator added in v1.11.0

func NewStaticAuthenticator(config *AuthenticatorConfig, allow bool) (*StaticAuthenticator, error)

func (*StaticAuthenticator) Authenticate added in v1.11.0

func (self *StaticAuthenticator) Authenticate(w http.ResponseWriter, req *http.Request) bool

func (*StaticAuthenticator) Callback added in v1.11.0

func (self *StaticAuthenticator) Callback(w http.ResponseWriter, req *http.Request)

func (*StaticAuthenticator) IsCallback added in v1.11.0

func (self *StaticAuthenticator) IsCallback(_ *url.URL) bool

func (*StaticAuthenticator) Name added in v1.11.0

func (self *StaticAuthenticator) Name() string

type StepConfig added in v1.11.0

type StepConfig struct {
	Type    string      `yaml:"type"              json:"type"`              // The type of step
	Data    interface{} `yaml:"data"              json:"data"`              // The data being passed into this step from the previous one
	Timeout string      `yaml:"timeout,omitempty" json:"timeout,omitempty"` // Timeout for this step
	Parser  string      `yaml:"parser"            json:"parser"`            // The format the data being passed in is expected to be in
	Output  interface{} `yaml:"-"                 json:"-"`
	Error   error       `yaml:"-"                 json:"-"`
	// contains filtered or unexported fields
}

func (*StepConfig) Close added in v1.12.9

func (self *StepConfig) Close() error

func (*StepConfig) Perform added in v1.11.0

func (self *StepConfig) Perform(_ *StepConfig, w http.ResponseWriter, req *http.Request, prev *StepConfig) (interface{}, error)

func (*StepConfig) Read added in v1.12.9

func (self *StepConfig) Read(b []byte) (int, error)

func (*StepConfig) String added in v1.11.0

func (self *StepConfig) String() string

type SwitchCase added in v1.9.9

type SwitchCase struct {
	CheckType   string    `yaml:"type,omitempty"      json:"type,omitempty"`      // The type of test to perform (one of: "expression", "querystring:<name>", "header:<name>")
	Condition   string    `yaml:"condition,omitempty" json:"condition,omitempty"` // A type-specific condition value (e.g.: an expression or querystring value)
	UsePath     string    `yaml:"use,omitempty"       json:"use,omitempty"`       // The template to load if the condition matches
	Redirect    *Redirect `yaml:"redirect,omitempty"  json:"redirect,omitempty"`  // An HTTP Redirect to perform if the condition matches
	Break       bool      `yaml:"break"               json:"break"`               // If this case matches, no additional cases should be considered
	Fallthrough bool      `yaml:"fallthrough"         json:"fallthrough"`         // If this case matches, control should fall immediately to the first fallback option.
}

func (*SwitchCase) Equals added in v1.20.1

func (self *SwitchCase) Equals(other *SwitchCase) bool

func (*SwitchCase) IsFallback added in v1.20.1

func (self *SwitchCase) IsFallback() bool

type Template

type Template struct {
	// contains filtered or unexported fields
}

func NewTemplate

func NewTemplate(name string, engine Engine) *Template

func (*Template) AddPostProcessors

func (self *Template) AddPostProcessors(postprocessors ...string) error

func (*Template) Engine

func (self *Template) Engine() Engine

func (*Template) Funcs

func (self *Template) Funcs(funcs FuncMap)

func (*Template) ParseFragments added in v1.11.0

func (self *Template) ParseFragments(fragments FragmentSet) error

func (*Template) ParseFrom

func (self *Template) ParseFrom(r io.Reader) error

func (*Template) ParseString added in v1.11.0

func (self *Template) ParseString(input string) error

func (*Template) Render

func (self *Template) Render(w io.Writer, data interface{}, subtemplate string) error

func (*Template) SetDelimiters added in v1.10.7

func (self *Template) SetDelimiters(open string, close string)

func (*Template) SetEngine

func (self *Template) SetEngine(engine Engine)

func (*Template) SetHeaderOffset

func (self *Template) SetHeaderOffset(offset int)

func (*Template) SetPrewriteFunc added in v1.11.0

func (self *Template) SetPrewriteFunc(fn func())

type TemplateHeader

type TemplateHeader struct {
	Page           map[string]interface{} `yaml:"page,omitempty"            json:"page,omitempty"`            // An object that is accessible to this template (and all inheriting templates) under the `$.page` variable.
	Bindings       []Binding              `yaml:"bindings,omitempty"        json:"bindings,omitempty"`        // An array of remote URLs to to be retrieved (in order) and added to the `$.bindings` object.
	Defaults       map[string]string      `yaml:"defaults,omitempty"        json:"defaults,omitempty"`        // An object containing default query string values that can be accessed via the `qs` function.
	DefaultHeaders map[string]string      `yaml:"default_headers,omitempty" json:"default_headers,omitempty"` // An object containing default HTTP request header values that can be accessed via the `$.request.headers` variable.
	Redirect       *Redirect              `yaml:"redirect,omitempty"        json:"redirect,omitempty"`        // Specifies an HTTP redirect should be performed when this page is accessed.
	Switch         []*SwitchCase          `yaml:"switch,omitempty"          json:"switch,omitempty"`          // Specify which template file to load in lieu of this one depending on which condition evaluates true first.
	Layout         string                 `yaml:"layout,omitempty"          json:"layout,omitempty"`          // The name of the layout (in the _layouts folder) to apply to this template.
	Includes       map[string]string      `yaml:"includes,omitempty"        json:"includes,omitempty"`        // An object specifying a custom name and path to other templates to include when evaluating this one.
	Headers        map[string]interface{} `yaml:"headers,omitempty"         json:"headers,omitempty"`         // A map of HTTP Headers to include in the request
	UrlParams      []KV                   `yaml:"url_params,omitempty"      json:"url_params,omitempty"`      // A map of query string parameters to include in the request
	FlagDefs       map[string]interface{} `yaml:"flags,omitempty"           json:"flags,omitempty"`           // An object containing names and expressions to add to a `$.flags` variable.
	Postprocessors []string               `yaml:"postprocessors,omitempty"  json:"postprocessors,omitempty"`  // An array of built-in postprocessors to apply to the output before being returned to the user.
	Renderer       string                 `yaml:"renderer,omitempty"        json:"renderer,omitempty"`        // The built-in renderer to use when generating the page.
	Translations   map[string]interface{} `yaml:"translations,omitempty"    json:"translations,omitempty"`    // Stores translations for use with the i18n and l10n functions.  Keys values represent the
	Locale         string                 `yaml:"locale"                    json:"locale"`                    // Stores the locale used for this page.  If Locale is set on multiple levels of rendering, the last evaluated value is used.
	QueryJoiner    string                 `yaml:"query_joiner,omitempty"    json:"query_joiner,omitempty"`    // Override the string used to join multiple values of the same query string parameter.
	HeaderJoiner   string                 `yaml:"header_joiner,omitempty"   json:"header_joiner,omitempty"`   // Override the string used to join multiple values of the same HTTP header.
	StatusCode     int                    `yaml:"code,omitempty"            json:"code,omitempty"`            // Override the HTTP response status code of this page
	// contains filtered or unexported fields
}

func SplitTemplateHeaderContent

func SplitTemplateHeaderContent(reader io.Reader) (*TemplateHeader, []byte, error)

func (*TemplateHeader) Merge

func (self *TemplateHeader) Merge(other *TemplateHeader) (*TemplateHeader, error)

type TemplateRenderer added in v1.9.20

type TemplateRenderer struct {
	// contains filtered or unexported fields
}

func (*TemplateRenderer) Render added in v1.9.20

func (self *TemplateRenderer) Render(w http.ResponseWriter, req *http.Request, options RenderOptions) error

func (*TemplateRenderer) SetPrewriteFunc added in v1.11.0

func (self *TemplateRenderer) SetPrewriteFunc(fn PrewriteFunc)

func (*TemplateRenderer) SetServer added in v1.13.11

func (self *TemplateRenderer) SetServer(server *Server)

func (*TemplateRenderer) ShouldPrerender added in v1.9.22

func (self *TemplateRenderer) ShouldPrerender() bool

type TlsConfig added in v1.13.10

type TlsConfig struct {
	Enable         bool   `yaml:"enable"   json:"enable"`   // Whether to enable SSL/TLS on the server.
	CertFile       string `yaml:"cert"     json:"cert"`     // path to a PEM-encoded (.crt) file containing the server's TLS public key.
	KeyFile        string `yaml:"key"      json:"key"`      // path to a PEM-encoded (.key) file containing the server's TLS private key.
	ClientCertMode string `yaml:"clients"  json:"clients"`  // If set, TLS Client certificates will be requested/accepted.  If set, may be one of: "request", "any", "verify", "require"
	ClientCAFile   string `yaml:"clientCA" json:"clientCA"` // Path to a PEM-encoded file containing the CA that client certificates are issued and verify against.
}

type TraceMapping added in v1.18.2

type TraceMapping struct {
	Match   string `yaml:"match"   json:"match"`   // A regular expression used to match candidate trace operation names
	Replace string `yaml:"replace" json:"replace"` // A string that will replace matching operation names.
	// contains filtered or unexported fields
}

func (*TraceMapping) TraceName added in v1.18.3

func (self *TraceMapping) TraceName(candidate string) (string, bool)

type Upgrader added in v1.20.25

type Upgrader = websocket.Upgrader

type WebsocketConn added in v1.20.25

type WebsocketConn = websocket.Conn

type WebsocketHandlerFunc added in v1.20.25

type WebsocketHandlerFunc = func(http.ResponseWriter, *http.Request, *WebsocketConn)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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