Documentation ¶
Index ¶
- type APIBuilder
- func (ab *APIBuilder) AddBlacklist(ips ...string) *APIBuilder
- func (ab *APIBuilder) AddDefaultValueCookie(name, value string) *APIBuilder
- func (ab *APIBuilder) AddDefaultValueHeader(name, value string) *APIBuilder
- func (ab *APIBuilder) AddDispatchNode(cluster uint64) *APIBuilder
- func (ab *APIBuilder) AddDispatchNodeValidation(cluster uint64, param metapb.Parameter, rule string, required bool) *APIBuilder
- func (ab *APIBuilder) AddPerm(perm string) *APIBuilder
- func (ab *APIBuilder) AddWhitelist(ips ...string) *APIBuilder
- func (ab *APIBuilder) AuthPlugin(name string) *APIBuilder
- func (ab *APIBuilder) Commit() (uint64, error)
- func (ab *APIBuilder) DefaultValue(value []byte) *APIBuilder
- func (ab *APIBuilder) DispatchNodeURLRewrite(cluster uint64, urlRewrite string) *APIBuilder
- func (ab *APIBuilder) DispatchNodeValueAttrName(cluster uint64, attrName string) *APIBuilder
- func (ab *APIBuilder) Down() *APIBuilder
- func (ab *APIBuilder) MatchDomain(domain string) *APIBuilder
- func (ab *APIBuilder) MatchMethod(method string) *APIBuilder
- func (ab *APIBuilder) MatchURLPattern(urlPattern string) *APIBuilder
- func (ab *APIBuilder) Name(name string) *APIBuilder
- func (ab *APIBuilder) NoBlacklist() *APIBuilder
- func (ab *APIBuilder) NoDefaultValue() *APIBuilder
- func (ab *APIBuilder) NoWhitelist() *APIBuilder
- func (ab *APIBuilder) RemoveBlacklist(ips ...string) *APIBuilder
- func (ab *APIBuilder) RemoveDispatchNodeURLRewrite(cluster uint64) *APIBuilder
- func (ab *APIBuilder) RemovePerm(perm string) *APIBuilder
- func (ab *APIBuilder) RemoveWhitelist(ips ...string) *APIBuilder
- func (ab *APIBuilder) UP() *APIBuilder
- func (ab *APIBuilder) Use(value metapb.API) *APIBuilder
- type Client
- type ClusterBuilder
- type RoutingBuilder
- func (rb *RoutingBuilder) AddCondition(param metapb.Parameter, op metapb.CMP, expect string) *RoutingBuilder
- func (rb *RoutingBuilder) Commit() (uint64, error)
- func (rb *RoutingBuilder) Down() *RoutingBuilder
- func (rb *RoutingBuilder) Strategy(strategy metapb.RoutingStrategy) *RoutingBuilder
- func (rb *RoutingBuilder) To(clusterID uint64) *RoutingBuilder
- func (rb *RoutingBuilder) TrafficRate(rate int) *RoutingBuilder
- func (rb *RoutingBuilder) Up() *RoutingBuilder
- func (rb *RoutingBuilder) Use(value metapb.Routing) *RoutingBuilder
- type ServerBuilder
- func (sb *ServerBuilder) Addr(addr string) *ServerBuilder
- func (sb *ServerBuilder) CheckHTTPBody(path, body string, interval time.Duration, timeout time.Duration) *ServerBuilder
- func (sb *ServerBuilder) CheckHTTPCode(path string, interval time.Duration, timeout time.Duration) *ServerBuilder
- func (sb *ServerBuilder) CircuitBreakerCheckPeriod(checkPeriod time.Duration) *ServerBuilder
- func (sb *ServerBuilder) CircuitBreakerCloseToHalfTimeout(timeout time.Duration) *ServerBuilder
- func (sb *ServerBuilder) CircuitBreakerHalfToCloseCondition(failureRate int) *ServerBuilder
- func (sb *ServerBuilder) CircuitBreakerHalfToOpenCondition(succeedRate int) *ServerBuilder
- func (sb *ServerBuilder) CircuitBreakerHalfTrafficRate(rate int) *ServerBuilder
- func (sb *ServerBuilder) Commit() (uint64, error)
- func (sb *ServerBuilder) HTTPBackend() *ServerBuilder
- func (sb *ServerBuilder) MaxQPS(max int64) *ServerBuilder
- func (sb *ServerBuilder) NoCircuitBreaker() *ServerBuilder
- func (sb *ServerBuilder) NoHeathCheck() *ServerBuilder
- func (sb *ServerBuilder) Use(value metapb.Server) *ServerBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIBuilder ¶
type APIBuilder struct {
// contains filtered or unexported fields
}
APIBuilder api builder
func (*APIBuilder) AddBlacklist ¶
func (ab *APIBuilder) AddBlacklist(ips ...string) *APIBuilder
AddBlacklist add ip black list
func (*APIBuilder) AddDefaultValueCookie ¶
func (ab *APIBuilder) AddDefaultValueCookie(name, value string) *APIBuilder
AddDefaultValueCookie add default value cookie
func (*APIBuilder) AddDefaultValueHeader ¶
func (ab *APIBuilder) AddDefaultValueHeader(name, value string) *APIBuilder
AddDefaultValueHeader add default value header
func (*APIBuilder) AddDispatchNode ¶
func (ab *APIBuilder) AddDispatchNode(cluster uint64) *APIBuilder
AddDispatchNode add a dispatch node
func (*APIBuilder) AddDispatchNodeValidation ¶
func (ab *APIBuilder) AddDispatchNodeValidation(cluster uint64, param metapb.Parameter, rule string, required bool) *APIBuilder
AddDispatchNodeValidation add dispatch node validation
func (*APIBuilder) AddPerm ¶
func (ab *APIBuilder) AddPerm(perm string) *APIBuilder
AddPerm add a perm
func (*APIBuilder) AddWhitelist ¶
func (ab *APIBuilder) AddWhitelist(ips ...string) *APIBuilder
AddWhitelist add ip white list
func (*APIBuilder) AuthPlugin ¶
func (ab *APIBuilder) AuthPlugin(name string) *APIBuilder
AuthPlugin set a auth filter plugin
func (*APIBuilder) DefaultValue ¶
func (ab *APIBuilder) DefaultValue(value []byte) *APIBuilder
DefaultValue set default value
func (*APIBuilder) DispatchNodeURLRewrite ¶
func (ab *APIBuilder) DispatchNodeURLRewrite(cluster uint64, urlRewrite string) *APIBuilder
DispatchNodeURLRewrite set dispatch node url rewrite
func (*APIBuilder) DispatchNodeValueAttrName ¶
func (ab *APIBuilder) DispatchNodeValueAttrName(cluster uint64, attrName string) *APIBuilder
DispatchNodeValueAttrName set dispatch node attr name of value
func (*APIBuilder) MatchDomain ¶
func (ab *APIBuilder) MatchDomain(domain string) *APIBuilder
MatchDomain set a match domain
func (*APIBuilder) MatchMethod ¶
func (ab *APIBuilder) MatchMethod(method string) *APIBuilder
MatchMethod set a match method
func (*APIBuilder) MatchURLPattern ¶
func (ab *APIBuilder) MatchURLPattern(urlPattern string) *APIBuilder
MatchURLPattern set a match path
func (*APIBuilder) NoBlacklist ¶
func (ab *APIBuilder) NoBlacklist() *APIBuilder
NoBlacklist set no blacklist
func (*APIBuilder) NoDefaultValue ¶
func (ab *APIBuilder) NoDefaultValue() *APIBuilder
NoDefaultValue set no default value
func (*APIBuilder) NoWhitelist ¶
func (ab *APIBuilder) NoWhitelist() *APIBuilder
NoWhitelist set no whiltelist
func (*APIBuilder) RemoveBlacklist ¶
func (ab *APIBuilder) RemoveBlacklist(ips ...string) *APIBuilder
RemoveBlacklist remove ip white list
func (*APIBuilder) RemoveDispatchNodeURLRewrite ¶
func (ab *APIBuilder) RemoveDispatchNodeURLRewrite(cluster uint64) *APIBuilder
RemoveDispatchNodeURLRewrite remove dispatch node
func (*APIBuilder) RemovePerm ¶
func (ab *APIBuilder) RemovePerm(perm string) *APIBuilder
RemovePerm remove a perm
func (*APIBuilder) RemoveWhitelist ¶
func (ab *APIBuilder) RemoveWhitelist(ips ...string) *APIBuilder
RemoveWhitelist remove ip white list
type Client ¶
type Client interface { NewClusterBuilder() *ClusterBuilder RemoveCluster(id uint64) error GetCluster(id uint64) (*metapb.Cluster, error) GetClusterList(fn func(*metapb.Cluster) bool) error NewServerBuilder() *ServerBuilder RemoveServer(id uint64) error GetServer(id uint64) (*metapb.Server, error) GetServerList(fn func(*metapb.Server) bool) error NewAPIBuilder() *APIBuilder RemoveAPI(id uint64) error GetAPI(id uint64) (*metapb.API, error) GetAPIList(fn func(*metapb.API) bool) error NewRoutingBuilder() *RoutingBuilder RemoveRouting(id uint64) error GetRouting(id uint64) (*metapb.Routing, error) GetRoutingList(fn func(*metapb.Routing) bool) error AddBind(cluster, server uint64) error RemoveBind(cluster, server uint64) error RemoveClusterBind(cluster uint64) error GetBindServers(cluster uint64) ([]uint64, error) }
Client gateway client
type ClusterBuilder ¶
type ClusterBuilder struct {
// contains filtered or unexported fields
}
ClusterBuilder cluster builder
func (*ClusterBuilder) Loadbalance ¶
func (cb *ClusterBuilder) Loadbalance(lb metapb.LoadBalance) *ClusterBuilder
Loadbalance set a loadbalance
func (*ClusterBuilder) Name ¶
func (cb *ClusterBuilder) Name(name string) *ClusterBuilder
Name set a name
func (*ClusterBuilder) Use ¶
func (cb *ClusterBuilder) Use(value metapb.Cluster) *ClusterBuilder
Use use a cluster
type RoutingBuilder ¶
type RoutingBuilder struct {
// contains filtered or unexported fields
}
RoutingBuilder routing builder
func (*RoutingBuilder) AddCondition ¶
func (rb *RoutingBuilder) AddCondition(param metapb.Parameter, op metapb.CMP, expect string) *RoutingBuilder
AddCondition add condition
func (*RoutingBuilder) Down ¶
func (rb *RoutingBuilder) Down() *RoutingBuilder
Down down this routing
func (*RoutingBuilder) Strategy ¶
func (rb *RoutingBuilder) Strategy(strategy metapb.RoutingStrategy) *RoutingBuilder
Strategy set strategy for this routing
func (*RoutingBuilder) To ¶
func (rb *RoutingBuilder) To(clusterID uint64) *RoutingBuilder
To routing to
func (*RoutingBuilder) TrafficRate ¶
func (rb *RoutingBuilder) TrafficRate(rate int) *RoutingBuilder
TrafficRate set traffic rate for this routing
func (*RoutingBuilder) Use ¶
func (rb *RoutingBuilder) Use(value metapb.Routing) *RoutingBuilder
Use use a cluster
type ServerBuilder ¶
type ServerBuilder struct {
// contains filtered or unexported fields
}
ServerBuilder server builder
func (*ServerBuilder) Addr ¶
func (sb *ServerBuilder) Addr(addr string) *ServerBuilder
Addr set addr
func (*ServerBuilder) CheckHTTPBody ¶
func (sb *ServerBuilder) CheckHTTPBody(path, body string, interval time.Duration, timeout time.Duration) *ServerBuilder
CheckHTTPBody use a heath check
func (*ServerBuilder) CheckHTTPCode ¶
func (sb *ServerBuilder) CheckHTTPCode(path string, interval time.Duration, timeout time.Duration) *ServerBuilder
CheckHTTPCode use a heath check
func (*ServerBuilder) CircuitBreakerCheckPeriod ¶
func (sb *ServerBuilder) CircuitBreakerCheckPeriod(checkPeriod time.Duration) *ServerBuilder
CircuitBreakerCheckPeriod set circuit breaker period
func (*ServerBuilder) CircuitBreakerCloseToHalfTimeout ¶
func (sb *ServerBuilder) CircuitBreakerCloseToHalfTimeout(timeout time.Duration) *ServerBuilder
CircuitBreakerCloseToHalfTimeout set circuit breaker timeout that close status convert to half
func (*ServerBuilder) CircuitBreakerHalfToCloseCondition ¶
func (sb *ServerBuilder) CircuitBreakerHalfToCloseCondition(failureRate int) *ServerBuilder
CircuitBreakerHalfToCloseCondition set circuit breaker condition of half convert to close
func (*ServerBuilder) CircuitBreakerHalfToOpenCondition ¶
func (sb *ServerBuilder) CircuitBreakerHalfToOpenCondition(succeedRate int) *ServerBuilder
CircuitBreakerHalfToOpenCondition set circuit breaker condition of half convert to open
func (*ServerBuilder) CircuitBreakerHalfTrafficRate ¶
func (sb *ServerBuilder) CircuitBreakerHalfTrafficRate(rate int) *ServerBuilder
CircuitBreakerHalfTrafficRate set circuit breaker traffic in half status
func (*ServerBuilder) HTTPBackend ¶
func (sb *ServerBuilder) HTTPBackend() *ServerBuilder
HTTPBackend set backend is http backend
func (*ServerBuilder) MaxQPS ¶
func (sb *ServerBuilder) MaxQPS(max int64) *ServerBuilder
MaxQPS set max qps
func (*ServerBuilder) NoCircuitBreaker ¶
func (sb *ServerBuilder) NoCircuitBreaker() *ServerBuilder
NoCircuitBreaker no circuit breaker
func (*ServerBuilder) NoHeathCheck ¶
func (sb *ServerBuilder) NoHeathCheck() *ServerBuilder
NoHeathCheck no heath check
func (*ServerBuilder) Use ¶
func (sb *ServerBuilder) Use(value metapb.Server) *ServerBuilder
Use use a server