support

package
v0.7.18 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsPtr added in v0.7.0

func AsPtr[T any](in T) *T

func ChannelDoOnEvent

func ChannelDoOnEvent(of Channel, what func())

func CorrelationIdOfRequest added in v0.1.12

func CorrelationIdOfRequest(req *http.Request) any

func CreateDummyCertificate

func CreateDummyCertificate() (tls.Certificate, error)

func CreateDummyCertificateFor added in v0.1.18

func CreateDummyCertificateFor(name string) (tls.Certificate, error)

func CreatePrivateKey

func CreatePrivateKey() (interface{}, error)

func FlagEnvName

func FlagEnvName(appPrefix, name string) string

func FlagEnvNameNormalize

func FlagEnvNameNormalize(what string) string

func HostOfRequest

func HostOfRequest(req *http.Request) any

func Join

func Join(sep string, what ...interface{}) string

func Must

func Must(err error)

func NegotiateContentType

func NegotiateContentType(requestedAccept string, offers []string) string

func NegotiateContentTypeOf

func NegotiateContentTypeOf(req *http.Request, offers ...string) string

func NormalizeHeaderContent

func NormalizeHeaderContent(val string) string

func PathOfRequest

func PathOfRequest(req *http.Request) string

func PublicKeyOf

func PublicKeyOf(candidate interface{}) interface{}

func QuoteAllIfNeeded

func QuoteAllIfNeeded(in ...string) []string

func QuoteAndJoin

func QuoteAndJoin(in ...string) string

func QuoteIfNeeded

func QuoteIfNeeded(what string) string

func RemoteIpOfRequest

func RemoteIpOfRequest(req *http.Request) any

func RequestBasedLazyFor added in v0.7.0

func RequestBasedLazyFor(req *http.Request, delegate func(*http.Request) any) fields.Lazy

func RequestIdOfRequest

func RequestIdOfRequest(req *http.Request) string

func SplitExt

func SplitExt(in string) (path, ext string)

func ToChan

func ToChan(channel Channel) chan struct{}

func UriOfRequest

func UriOfRequest(req *http.Request) any

func UserAgentOfRequest

func UserAgentOfRequest(req *http.Request) string

func UserAgentOfRequestAny added in v0.7.0

func UserAgentOfRequestAny(req *http.Request) any

Types

type AcceptRange

type AcceptRange struct {
	// Type represents the media type.
	Type string
	// Subtype represents the media subtype.
	Subtype string
	// Weight represents the weight (quality factor) of this range.
	Weight float64
	// Parameters represents the parameters that are applicable to this range.
	Parameters map[string]string
	// contains filtered or unexported fields
}

AcceptRange represents a media-range contained within an Accept header.

func ParseAcceptRange

func ParseAcceptRange(accept string) AcceptRange

ParseAcceptRange returns the media range, params and quality factor (weight) from an Accept range.

func ParseAcceptRanges

func ParseAcceptRanges(accepts string) []AcceptRange

ParseAcceptRanges returns the set of accepted media ranges from an Accept header.

func (AcceptRange) RawString

func (a AcceptRange) RawString() string

RawString returns the raw string for this accept range.

type Channel

type Channel interface {
	Wait()
	Broadcast()
}

func NewChannel

func NewChannel() Channel

type FlagEnabled

type FlagEnabled interface {
	Flag(name, help string) *kingpin.FlagClause
}

type GenericResponse

type GenericResponse struct {
	XMLName       xml.Name    `json:"-" yaml:"-" xml:"response"`
	Timestamp     string      `json:"timestamp" yaml:"timestamp" xml:"timestamp"`
	Status        int         `json:"status" yaml:"status" xml:"status"`
	Message       string      `json:"message,omitempty" yaml:"message,omitempty" xml:"message,omitempty"`
	Path          string      `json:"path" yaml:"path" xml:"path"`
	RequestId     string      `json:"requestId,omitempty" yaml:"requestId,omitempty" xml:"requestId,omitempty"`
	CorrelationId string      `json:"correlationId,omitempty" yaml:"correlationId,omitempty" xml:"correlationId,omitempty"`
	Data          interface{} `json:"data,omitempty" yaml:"data,omitempty" xml:"data,omitempty"`

	ErrorHandler func(resp http.ResponseWriter, req *http.Request, message string, err error, status int)
}

func NewGenericResponse

func NewGenericResponse(statusCode int, message string, req *http.Request) GenericResponse

func (GenericResponse) StreamJsonTo

func (this GenericResponse) StreamJsonTo(resp http.ResponseWriter, req *http.Request, logProvider func() log.Logger)

func (GenericResponse) StreamXmlTo

func (this GenericResponse) StreamXmlTo(resp http.ResponseWriter, req *http.Request, logProvider func() log.Logger)

func (GenericResponse) StreamYamlTo

func (this GenericResponse) StreamYamlTo(resp http.ResponseWriter, req *http.Request, logProvider func() log.Logger)

func (GenericResponse) WithData

func (this GenericResponse) WithData(data interface{}) GenericResponse

type Initializable added in v0.1.7

type Initializable interface {
	Init(stop Channel) error
}

type ObjectReference added in v0.7.0

type ObjectReference interface {
	ApiVersion() string
	Kind() string
	Namespace() string
	Name() string
	String() string
	ShortString() string
	Equals(ObjectReference) bool

	WithNamespace(string) ObjectReference
	WithName(string) ObjectReference
	WithGroupVersionKind(schema.GroupVersionKind) ObjectReference
	WithApiVersionAndKind(apiVersion, king string) ObjectReference
	GroupVersionKind() schema.GroupVersionKind
}

func NewObjectReferenceOf added in v0.7.0

func NewObjectReferenceOf(src ObjectReferenceSource) (ObjectReference, error)

type ObjectReferenceSource added in v0.7.0

type ObjectReferenceSource interface {
	v1.Object
	pr.Object
}

type RuntimeT

type RuntimeT struct {
	Revision  string    `yaml:"revision" json:"revision"`
	Branch    string    `yaml:"branch" json:"branch"`
	Build     time.Time `yaml:"build" json:"build"`
	GoVersion string    `yaml:"goVersion" json:"goVersion"`
	Os        string    `yaml:"os" json:"os"`
	Arch      string    `yaml:"arch" json:"arch"`
}

RuntimeT hold the runtime information about this application. To provide the correct information to also enable the usage of:

Runtime()

...you have to call the build process with the correct parameters. We have build for that a small utility that escapes everything in the right order:

go run github.com/echocat/lingress/build \
	-b <branch> \
	-b <revision> \
	-o <output> \
	[<package>]         # Default ./

Example:

go run github.com/echocat/lingress/build \
	-g travel-the-pipe \
	-a some-backend \
	-b $BRANCH \
	-b $REVISION \
	-o out/app \
	./

func Runtime

func Runtime() RuntimeT

Runtime returns an instance of RuntimeT

func (RuntimeT) LongString added in v0.7.0

func (this RuntimeT) LongString() string

func (RuntimeT) MarshalText

func (this RuntimeT) MarshalText() (text []byte, err error)

func (RuntimeT) String

func (this RuntimeT) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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