config

package
v0.0.40 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Servers    []Server   `json:"servers"`
	Namespaces Namespaces `json:"namespaces"`
	Ika        Ika        `json:"ika"`
}

func Read

func Read(path string) (Config, error)

type Dialer added in v0.0.32

type Dialer struct {
	Timeout         Duration        `json:"timeout"`
	FallbackDelay   Duration        `json:"fallbackDelay"`
	KeepAliveConfig KeepAliveConfig `json:"keepAliveConfig"`
}

type Duration added in v0.0.23

type Duration time.Duration

func (Duration) Dur added in v0.0.23

func (d Duration) Dur() time.Duration

func (Duration) LogValue added in v0.0.28

func (d Duration) LogValue() slog.Value

func (*Duration) UnmarshalJSON added in v0.0.23

func (d *Duration) UnmarshalJSON(b []byte) error

type Ika

type Ika struct {
	Logger                  Logger   `json:"logger"`
	GracefulShutdownTimeout Duration `json:"gracefulShutdownTimeout"`
}

type KeepAliveConfig added in v0.0.32

type KeepAliveConfig struct {
	Enable   bool     `json:"enable"`
	Idle     Duration `json:"idle"`
	Interval Duration `json:"interval"`
	Count    int      `json:"count"`
}

type Logger added in v0.0.23

type Logger struct {
	Level         string   `json:"level"`
	Format        string   `json:"format"`
	FlushInterval Duration `json:"flushInterval"`
	AddSource     bool     `json:"addSource"`
}

func (*Logger) ApplyDefaults added in v0.0.32

func (l *Logger) ApplyDefaults()

func (Logger) LogValue added in v0.0.28

func (l Logger) LogValue() slog.Value

type Method

type Method string

func (*Method) UnmarshalJSON added in v0.0.28

func (m *Method) UnmarshalJSON(data []byte) error

type Namespace

type Namespace struct {
	Transport    Transport `json:"transport"`
	Mounts       []string  `json:"mounts"`
	Routes       Routes    `json:"routes"`
	Middlewares  Plugins   `json:"middlewares"`
	ReqModifiers Plugins   `json:"reqModifiers"`
	Hooks        Plugins   `json:"hooks"`
}

type Namespaces

type Namespaces map[string]Namespace

type Options added in v0.0.23

type Options struct {
	Plugins map[string]ika.PluginFactory
}

type Plugin added in v0.0.13

type Plugin struct {
	Name    string         `json:"name"`
	Enabled *bool          `json:"enabled"`
	Config  map[string]any `json:"config"`
}

type Plugins added in v0.0.13

type Plugins []Plugin

func (Plugins) Enabled added in v0.0.13

func (p Plugins) Enabled() iter.Seq[Plugin]

Enabled returns an iterator that yields all Enabled plugins.

func (Plugins) Names added in v0.0.22

func (p Plugins) Names() iter.Seq[string]

Names returns an iterator that yields all enabled plugin names.

type Route added in v0.0.40

type Route struct {
	Methods      []Method `json:"methods"`
	Middlewares  Plugins  `json:"middlewares"`
	ReqModifiers Plugins  `json:"reqModifiers"`
}

type Routes added in v0.0.40

type Routes map[string]Route

type Server

type Server struct {
	Addr                         string   `json:"addr"`
	DisableGeneralOptionsHandler bool     `json:"disableGeneralOptionsHandler"`
	ReadTimeout                  Duration `json:"readTimeout"`
	ReadHeaderTimeout            Duration `json:"readHeaderTimeout"`
	WriteTimeout                 Duration `json:"writeTimeout"`
	IdleTimeout                  Duration `json:"idleTimeout"`
	MaxHeaderBytes               int      `json:"maxHeaderBytes"`
}

type Transport

type Transport struct {
	DisableKeepAlives      bool     `json:"disableKeepAlives"`
	DisableCompression     bool     `json:"disableCompression"`
	MaxIdleConns           int      `json:"maxIdleConns"`
	MaxIdleConnsPerHost    int      `json:"maxIdleConnsPerHost"`
	MaxConnsPerHost        int      `json:"maxConnsPerHost"`
	IdleConnTimeout        Duration `json:"idleConnTimeout"`
	ResponseHeaderTimeout  Duration `json:"responseHeaderTimeout"`
	ExpectContinueTimeout  Duration `json:"expectContinueTimeout"`
	MaxResponseHeaderBytes int64    `json:"maxResponseHeaderBytes"`
	WriteBufferSize        int      `json:"writeBufferSize"`
	ReadBufferSize         int      `json:"readBufferSize"`
	Dialer                 Dialer   `json:"dialer"`
}

Jump to

Keyboard shortcuts

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