Documentation ¶
Index ¶
- Variables
- func ChannelDoOnEvent(of Channel, what func())
- func CorrelationIdOfRequest(req *http.Request) string
- func CreateDummyCertificate() (tls.Certificate, error)
- func CreatePrivateKey() (interface{}, error)
- func Executable() string
- func FlagEnvName(appPrefix, name string) string
- func FlagEnvNameNormalize(what string) string
- func HostOfRequest(req *http.Request) string
- func Join(sep string, what ...interface{}) string
- func LoadBundle(provider FileProvider) (bundle *i18n.Bundle, err error)
- func Must(err error)
- func MustRegisterGlobalFalgs(fe FlagEnabled, appPrefix string)
- func NegotiateContentType(requestedAccept string, offers []string) string
- func NegotiateContentTypeOf(req *http.Request, offers ...string) string
- func NormalizeHeaderContent(val string) string
- func PathOfRequest(req *http.Request) string
- func PublicKeyOf(candidate interface{}) interface{}
- func QuoteAllIfNeeded(in ...string) []string
- func QuoteAndJoin(in ...string) string
- func QuoteIfNeeded(what string) string
- func RegisterGlobalFlags(fe FlagEnabled, appPrefix string) error
- func RemoteIpOfRequest(req *http.Request) string
- func RequestBasedLazyStringerFor(req *http.Request, delegate func(*http.Request) string) fmt.Stringer
- func RequestIdOfRequest(req *http.Request) string
- func SplitExt(in string) (path, ext string)
- func StdLog(fields log.Fields, lvl log.Level) *stdlog.Logger
- func ToChan(channel Channel) chan struct{}
- func ToLazyStringer(in StringerFunc) fmt.Stringer
- func UriOfRequest(req *http.Request) string
- func UserAgentOfRequest(req *http.Request) string
- type AcceptRange
- type Channel
- type DefaultFileProviders
- type FileProvider
- type FileProviders
- type FlagEnabled
- type FlagRegistrar
- type GenericResponse
- func (instance GenericResponse) StreamJsonTo(resp http.ResponseWriter, req *http.Request)
- func (instance GenericResponse) StreamXmlTo(resp http.ResponseWriter, req *http.Request)
- func (instance GenericResponse) StreamYamlTo(resp http.ResponseWriter, req *http.Request)
- func (instance GenericResponse) WithData(data interface{}) GenericResponse
- type Initializable
- type LocalizationContext
- type LogWriter
- type RuntimeT
- type StringerFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var (
EmptyBundle = errors.New("empty bundle")
)
View Source
var (
Pool *x509.CertPool
)
Functions ¶
func ChannelDoOnEvent ¶
func ChannelDoOnEvent(of Channel, what func())
func CorrelationIdOfRequest ¶ added in v0.1.12
func CreateDummyCertificate ¶
func CreateDummyCertificate() (tls.Certificate, error)
func CreatePrivateKey ¶
func CreatePrivateKey() (interface{}, error)
func FlagEnvName ¶
func FlagEnvNameNormalize ¶
func HostOfRequest ¶
func LoadBundle ¶
func LoadBundle(provider FileProvider) (bundle *i18n.Bundle, err error)
func MustRegisterGlobalFalgs ¶
func MustRegisterGlobalFalgs(fe FlagEnabled, appPrefix string)
func NegotiateContentType ¶
func NegotiateContentTypeOf ¶
func NormalizeHeaderContent ¶
func PathOfRequest ¶
func PublicKeyOf ¶
func PublicKeyOf(candidate interface{}) interface{}
func QuoteAllIfNeeded ¶
func QuoteAndJoin ¶
func QuoteIfNeeded ¶
func RegisterGlobalFlags ¶
func RegisterGlobalFlags(fe FlagEnabled, appPrefix string) error
func RemoteIpOfRequest ¶
func RequestIdOfRequest ¶
func ToLazyStringer ¶
func ToLazyStringer(in StringerFunc) fmt.Stringer
func UriOfRequest ¶
func UserAgentOfRequest ¶
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 DefaultFileProviders ¶
type DefaultFileProviders struct { Localization FileProvider Static FileProvider Templates FileProvider }
func (DefaultFileProviders) GetLocalization ¶
func (instance DefaultFileProviders) GetLocalization() FileProvider
func (DefaultFileProviders) GetStatic ¶
func (instance DefaultFileProviders) GetStatic() FileProvider
func (DefaultFileProviders) GetTemplates ¶
func (instance DefaultFileProviders) GetTemplates() FileProvider
type FileProvider ¶
type FileProviders ¶
type FileProviders interface { GetLocalization() FileProvider GetStatic() FileProvider GetTemplates() FileProvider }
type FlagEnabled ¶
type FlagEnabled interface {
Flag(name, help string) *kingpin.FlagClause
}
type FlagRegistrar ¶
type FlagRegistrar interface {
RegisterFlag(fe FlagEnabled, appPrefix string) error
}
func RegisterFlagRegistrar ¶
func RegisterFlagRegistrar(fr FlagRegistrar) FlagRegistrar
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 (instance GenericResponse) StreamJsonTo(resp http.ResponseWriter, req *http.Request)
func (GenericResponse) StreamXmlTo ¶
func (instance GenericResponse) StreamXmlTo(resp http.ResponseWriter, req *http.Request)
func (GenericResponse) StreamYamlTo ¶
func (instance GenericResponse) StreamYamlTo(resp http.ResponseWriter, req *http.Request)
func (GenericResponse) WithData ¶
func (instance GenericResponse) WithData(data interface{}) GenericResponse
type Initializable ¶ added in v0.1.7
type LocalizationContext ¶
func (*LocalizationContext) LangBy ¶
func (instance *LocalizationContext) LangBy(id string) language.Tag
func (*LocalizationContext) Message ¶
func (instance *LocalizationContext) Message(id string) string
func (*LocalizationContext) MessageOrDefault ¶
func (instance *LocalizationContext) MessageOrDefault(fallbackId string, id string) string
type RuntimeT ¶
type RuntimeT struct { GroupId string `yaml:"groupId" json:"groupId"` ArtifactId string `yaml:"artifactId" json:"artifactId"` 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 \ [-g <groupId>] \ # Default: "" -a <artifactId> \ -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 (RuntimeT) MarshalText ¶
func (RuntimeT) ShortString ¶
type StringerFunc ¶
type StringerFunc func() string
Click to show internal directories.
Click to hide internal directories.