config

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	Target string
	Weight *int64
}

type CircuitBreaker

type CircuitBreaker struct {
	Trigger *struct {
		SuccessRatio *struct {
			Success float64
			Request int
			Bucket  int
			Window  time.Duration
		}
		Ratio int64
	}
	Action struct {
		ResponseData *struct {
			StatusCode int
			Header     []struct {
				Key   string
				Value []string
			}
			Body []byte
		}
		BackupService *struct {
			Endpoint Endpoint
		}
	}
	Conditions []Condition
}

type Condition

type Condition struct {
	Header     *Header
	StatusCode string
}

type Config

type Config struct {
	Debug       bool
	Addr        string
	Discovery   string
	Endpoints   []Endpoint
	Middlewares []Middleware
	// contains filtered or unexported fields
}

func New

func New(source kc.Source) (*Config, error)

New 新建并初始化配置

func (*Config) WatchEndpoints

func (c *Config) WatchEndpoints(fn Watch)

WatchEndpoints 监听配置

type Cors

type Cors struct {
	AllowCredentials    bool
	AllowOrigins        []string
	AllowMethods        []string
	AllowHeaders        []string
	ExposeHeaders       []string
	MaxAge              time.Duration
	AllowPrivateNetwork bool
}

type Endpoint

type Endpoint struct {
	Path           string
	Method         string
	Description    string
	Protocol       string
	ResponseFormat bool
	Timeout        time.Duration
	Metadata       map[string]string
	Host           string
	Middlewares    []Middleware
	Backends       []Backend
	Retry          *Retry
}
type Header struct {
	Name  string
	Value string
}

type Middleware

type Middleware struct {
	Name     string
	Options  map[string]interface{}
	Required bool
}

type Retry

type Retry struct {
	Count      int
	Timeout    time.Duration
	Conditions []Condition
}

type Rewrite

type Rewrite struct {
	PathRewrite            string
	RequestHeadersRewrite  *RewriteHeadersPolicy
	ResponseHeadersRewrite *RewriteHeadersPolicy
	StripPrefix            string
	HostRewrite            string
}

type RewriteHeadersPolicy

type RewriteHeadersPolicy struct {
	Set    map[string]string
	Add    map[string]string
	Remove []string
}

type Tracing

type Tracing struct {
	Endpoint    string
	SampleRatio float64
	Timeout     time.Duration
	Insecure    bool
}

type Watch

type Watch func(*Config)

Jump to

Keyboard shortcuts

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