core

package
v0.0.0-...-dca265f Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2018 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CertsChangeListen

func CertsChangeListen()

func ConnectStore

func ConnectStore(endPoints []string, username, password string) error

func DelDomainMetrics

func DelDomainMetrics(domain *Domain)

func DelDomainPathMetrics

func DelDomainPathMetrics(domain *Domain, path *Path)

func DomainKToBakDomainK

func DomainKToBakDomainK(domainK string) string

域名key装域名备份的key

func GateWaySerName

func GateWaySerName() string

func GetCert

func GetCert(info *tls.ClientHelloInfo) (certificate *tls.Certificate, e error)

func GetMetrics

func GetMetrics() metrics.Registry

func GetReqListenMap

func GetReqListenMap() map[string][]*RequestListen

func InitCerts

func InitCerts()

func PathKToBakPathK

func PathKToBakPathK(dataK string) string

路径key转路径备份的key

func Proxy

func Proxy() *logrus.Logger

func PutRequestCopy

func PutRequestCopy(requestCopy *RequestCopy) bool

func RecordMetrics

func RecordMetrics(serName string)

定时更新监控数据

func RequestListenRun

func RequestListenRun()

func SetSerName

func SetSerName(name string)

func Sys

func Sys() *logrus.Logger

func WatchDomains

func WatchDomains(e chan *clientv3.Event)

func WatchPaths

func WatchPaths(e chan *clientv3.Event)

Types

type Cert

type Cert struct {
	Id           string `json:"id"`
	SerName      string `json:"ser_name"`
	CertBlock    string `json:"cert_block"`
	CertKeyBlock string `json:"cert_key_block"`
}

type Domain

type Domain struct {
	Id                 string          `json:"id"`
	DomainName         string          `json:"domain_name"`
	DomainUrl          string          `json:"domain_url"`
	LbType             string          `json:"lb_type"`
	Targets            []*Target       `json:"targets"`
	BlackIps           map[string]bool `json:"black_ips"`
	RateLimiterNum     float64         `json:"rate_limiter_num"`
	RateLimiterMsg     string          `json:"rate_limiter_msg"`
	RateLimiterEnabled bool            `json:"rate_limiter_enabled"`
	Paths              []*Path         `json:"paths"`
}

func DomainDataById

func DomainDataById(domainId string, getPaths bool) (*Domain, error)

func DomainDataByK

func DomainDataByK(domainK string, getPaths bool) (*Domain, error)

func DomainsData

func DomainsData() ([]*Domain, error)

type Metrics

type Metrics struct {
	Timer      metrics.Timer
	Histograms metrics.Histogram
}

func NewDomainMetrics

func NewDomainMetrics(domain *Domain) *Metrics

func NewDomainPathMetrics

func NewDomainPathMetrics(domain *Domain, path *Path) *Metrics

type Path

type Path struct {
	Id                    string    `json:"id"`
	DomainId              string    `json:"domain_id"`
	ReqMethod             string    `json:"req_method"`
	ReqPath               string    `json:"req_path"`
	SearchPath            string    `json:"search_path"`
	ReplacePath           string    `json:"replace_path"`
	CircuitBreakerRequest int       `json:"circuit_breaker_request"`
	CircuitBreakerPercent int       `json:"circuit_breaker_percent"`
	CircuitBreakerTimeout int       `json:"circuit_breaker_timeout"`
	CircuitBreakerMsg     string    `json:"circuit_breaker_msg"`
	CircuitBreakerEnabled bool      `json:"circuit_breaker_enabled"`
	CircuitBreakerForce   bool      `json:"circuit_breaker_force"`
	PrivateProxyEnabled   bool      `json:"private_proxy_enabled"`
	LbType                string    `json:"lb_type"`
	Targets               []*Target `json:"targets"`
	SetTime               string    `json:"set_time"`
}

func DomainPathData

func DomainPathData(dataK string) (*Path, error)

type RecordsData

type RecordsData struct {
	Time        int64                             `json:"time"`
	MetricsData map[string]map[string]interface{} `json:"metrics_data"`
}

type RequestCopy

type RequestCopy struct {
	SerName   string      `json:"ser_name"`
	Id        string      `json:"id"`
	ReqTime   string      `json:"req_time"`
	ReqIp     string      `json:"req_ip"`
	ReqPath   string      `json:"req_path"`
	PostForm  interface{} `json:"post_form"`
	Get       string      `json:"get"`
	ReqHeader interface{} `json:"req_header"`
	RspSize   int         `json:"rsp_size"`
	RspHeader http.Header `json:"rsp_header"`
	RspBody   string      `json:"rsp_body"`
}

type RequestListen

type RequestListen struct {
	DomainUrl  string `json:"domain_url"`
	ListenPath string `json:"listen_path"`
}

type Target

type Target struct {
	Pointer       string `json:"pointer"`
	Weight        int8   `json:"weight"`
	CurrentWeight int8   `json:"current_weight"`
}

Jump to

Keyboard shortcuts

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