utils

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2020 License: ISC Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(v bool) *bool

func BoolValue

func BoolValue(v *bool) bool

func CheckFileExists

func CheckFileExists(path string) bool

func FilePathClean

func FilePathClean(s *string) *string

func Float64

func Float64(v float64) *float64

func Float64Value

func Float64Value(v *float64) float64

func GetFeed

func GetFeed(timeout time.Duration, url string) (*gofeed.Feed, error)

func GetJSON

func GetJSON(timeout time.Duration, url string) (map[string]interface{}, error)

func GetPrometheus

func GetPrometheus(timeout time.Duration, url string) (map[string]*prom2json.Family, error)

func GetURL

func GetURL(timeout time.Duration, url string) ([]byte, error)

func Int

func Int(v int) *int

func IntValue

func IntValue(v *int) int

func IsStringEmpty

func IsStringEmpty(v *string) bool

func IsStringSliceEmpty

func IsStringSliceEmpty(v []string) bool

func NotStringEmpty

func NotStringEmpty(v *string) bool

func NotStringSliceEmpty

func NotStringSliceEmpty(v []string) bool

func PrettyDump

func PrettyDump(i interface{}) string

func PrettyPrint

func PrettyPrint(i interface{}) string

func PrintVersion

func PrintVersion()

func SplitRune

func SplitRune(s string, separators ...rune) []string

func String

func String(v string) *string

func StringValue

func StringValue(v *string) string

func WriteFile

func WriteFile(filename string, data []byte, perm os.FileMode) error

Types

type AtomicBool

type AtomicBool int32

func (*AtomicBool) IsSet

func (b *AtomicBool) IsSet() bool

func (*AtomicBool) SetFalse

func (b *AtomicBool) SetFalse()

func (*AtomicBool) SetFalseIfTrue

func (b *AtomicBool) SetFalseIfTrue() bool

func (*AtomicBool) SetTrue

func (b *AtomicBool) SetTrue()

func (*AtomicBool) SetTrueIfFalse

func (b *AtomicBool) SetTrueIfFalse() bool

type CacheConfig

type CacheConfig struct {
	Expiration *int               `json:"expiration,omitempty"`
	Memory     *CacheMemoryConfig `json:"memory,omitempty"`
}

Cache

type CacheMemoryConfig

type CacheMemoryConfig struct {
	Cleanup *int `json:"cleanup,omitempty"`
}

structs used by the global configuration block.

type ConfigRoot

type ConfigRoot struct {
	Log        *LogConfig        `json:"log,omitempty"`
	Prometheus *PrometheusConfig `json:"prometheus,omitempty"`
	Space      *SpaceConfig      `json:"space,omitempty"`
}

structs used by the global configuration block.

type HandlerConfig

type HandlerConfig struct {
	Name       *string           `json:"name,omitempty"`
	Parameters map[string]string `json:"parameters,omitempty"`
}

Handler

type ListenerConfig

type ListenerConfig struct {
	Address       *string    `json:"address,omitempty"`
	Domains       []string   `json:"domains,omitempty"`
	TLSConfig     *TLSConfig `json:"tls,omitempty"`
	ProxyProtocol *string    `json:"proxyprotocol,omitempty"`
}

Listener

type LogConfig

type LogConfig struct {
	Level         *string `json:"level,omitempty"`
	Format        *string `json:"format,omitempty"`
	To            *string `json:"to,omitempty"`
	SyslogAddress *string `json:"syslog,omitempty"`
}

Logger

type PrometheusAuthBasicConfig

type PrometheusAuthBasicConfig struct {
	Username *string `json:"username,omitempty"`
	Password *string `json:"password,omitempty"`
}

structs used by the global configuration block.

type PrometheusAuthConfig

type PrometheusAuthConfig struct {
	AuthBasic *PrometheusAuthBasicConfig `json:"basic,omitempty"`
}

structs used by the global configuration block.

type PrometheusConfig

type PrometheusConfig struct {
	Address       string `json:"address,omitempty"`
	Endpoint      string `json:"endpoint,omitempty"`
	SummaryMaxAge *int   `json:"summaryMaxAge,omitempty"`
	ChanSize      *int   `json:"chanSize,omitempty"`

	Auth *PrometheusAuthConfig `json:"auth,omitempty"`
}

Prometheus

type RouteCacheConfig

type RouteCacheConfig struct {
	Expiration *int `json:"expiration,omitempty"`
}

structs used by the global configuration block.

type RouteConfig

type RouteConfig struct {
	File     *string `json:"file,omitempty"`
	Template *string `json:"template,omitempty"`

	Fetch map[string]*RouteFetchConfig `json:"fetch,omitempty"`
	Cache *RouteCacheConfig            `json:"cache,omitempty"`
	Cron  *string                      `json:"cron,omitempty"`

	RegexpCapturedGroups []string
}

Route

type RouteFetchConfig

type RouteFetchConfig struct {
	Type *string `json:"type,omitempty"`
	URI  *string `json:"uri,omitempty"`
}

structs used by the global configuration block.

type RouteRegexpConfig

type RouteRegexpConfig struct {
	RouteConfig *RouteConfig
	Regexp      *regexp.Regexp
}

structs used by the global configuration block.

type SpaceConfig

type SpaceConfig struct {
	Handler *HandlerConfig `json:"handler,omitempty"`

	Cache *CacheConfig `json:"cache,omitempty"`

	Listener *ListenerConfig `json:"listener,omitempty"`

	BaseDir *string                 `json:"basedir,omitempty"`
	Routes  map[string]*RouteConfig `json:"routes,omitempty"`

	RoutesRegexp map[string]*RouteRegexpConfig
	Footer       *string
	Header       *string
	MutexRoutes  sync.RWMutex
}

Space

func (*SpaceConfig) GetRoute

func (sc *SpaceConfig) GetRoute(route string) *RouteConfig

type TLSACMEConfig

type TLSACMEConfig struct {
	DNSProvider *string               `json:"dnsprovider,omitempty"`
	Email       *string               `json:"email,omitempty"`
	CA          *string               `json:"ca,omitempty"`
	TestCA      *string               `json:"testca,omitempty"`
	Storage     *TLSACMEStorageConfig `json:"storage,omitempty"`
}

structs used by the global configuration block.

type TLSACMEFileStorageConfig

type TLSACMEFileStorageConfig struct {
	Path *string `json:"path,omitempty"`
}

structs used by the global configuration block.

type TLSACMEStorageConfig

type TLSACMEStorageConfig struct {
	File *TLSACMEFileStorageConfig `json:"file,omitempty"`
}

structs used by the global configuration block.

type TLSConfig

type TLSConfig struct {
	ACME *TLSACMEConfig `json:"acme,omitempty"`
}

structs used by the global configuration block.

Jump to

Keyboard shortcuts

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