Documentation
¶
Index ¶
- Constants
- type Client
- type DeleteRequest
- type DeleteResponse
- type ExclusiveSet
- type Interface
- type Location
- type LocationForwardStrategy
- type LocationHealthCheck
- type LocationRewrite
- type LocationSessionPersistence
- type MockClient
- type RealServer
- type Request
- type Response
- type ServerInfo
- type Service
- type UpdateRequest
- type UpdateResponse
Constants ¶
const ( // ProtocolHTTP gw service http protocol ProtocolHTTP = "HTTP" // ProtocolHTTPS gw service https protocol // Temporarily, only ProtocolHTTPS is used ProtocolHTTPS = "HTTPS" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client client for operate gw services
func NewClient ¶
func NewClient(ctx context.Context, cluster string, r *rdiscover.RegDiscover, zkPath string) *Client
NewClient create new client for gw server
func NewClientWithTLS ¶
func NewClientWithTLS(ctx context.Context, cluster string, r *rdiscover.RegDiscover, zkPath string, tlsConfig *tls.Config) *Client
NewClientWithTLS create new client for tls gw server
type DeleteRequest ¶
DeleteRequest request for delete gw services from concentrator cache
type DeleteResponse ¶
type DeleteResponse struct {
Response
}
DeleteResponse response for delete gw services
type ExclusiveSet ¶
ExclusiveSet exclusive set parameter
type Interface ¶
type Interface interface { Run() error Update(svcs []*Service) error Delete(svcs []*Service) error }
Interface interface to call gw api
type Location ¶
type Location struct { LocationID string `json:"location_id,omitempty"` URL string `json:"url"` LocationCustomizedConf string `json:"location_customized_conf"` LocLimitRate int `json:"loc_limit_rate"` LocLimitStatusCode int `json:"loc_limit_status_code"` ForwardStrategy *LocationForwardStrategy `json:"forward_strategy,omitempty"` SessionPersistence *LocationSessionPersistence `json:"session_persistence,omitempty"` HealthCheck *LocationHealthCheck `json:"health_check,omitempty"` RSList []*RealServer `json:"rs_list,omitempty"` Rewrite *LocationRewrite `json:"rewrite,omitempty"` }
Location location in request
func (*Location) GetNewLocationWithExtraRS ¶
GetNewLocationWithExtraRS get new location with extra real server of newL Location campared with l Location
type LocationForwardStrategy ¶
type LocationForwardStrategy struct { Type string `json:"type,omitempty"` //1.DEFAULT: detail默认为”wrr”,根据rs的权重转发请求数, detai:[“wrr”, “ip_hash”, “least_conn”] //2.REDIRECT: 无RS,将请求重定向到detail指定的url, //3.RETRUNFAIL:无RS,直接返回错误码,detail为错误码 Detail string `json:"detail,omitempty"` }
LocationForwardStrategy forward strategy for location
func (*LocationForwardStrategy) Diff ¶
func (lfs *LocationForwardStrategy) Diff(anotherLfs *LocationForwardStrategy) bool
Diff judge if anotherLfs LocationForwardStrategy is the same with lfs LocationForwardStrategy
type LocationHealthCheck ¶
type LocationHealthCheck struct { OP string `json:"op"` // set or del Protocol string `json:"protocol"` // HTTP AliveNum int `json:"alive_num"` KickNum int `json:"kick_num"` ProbeInterval int `json:"probe_interval"` AliveCode int `json:"alive_code"` ProbeURL string `json:"probe_url"` Method string `json:"method"` ServerName string `json:"server_name"` }
LocationHealthCheck health check for location
func (*LocationHealthCheck) Diff ¶
func (lhc *LocationHealthCheck) Diff(anotherLhc *LocationHealthCheck) bool
Diff judge anotherLhc LocationHealthCheck is the same with lhc LocationHealthCheck
type LocationRewrite ¶
type LocationRewrite struct { OP string `json:"op,omitempty"` Type string `json:"type"` URL string `json:"url"` }
LocationRewrite rewrite config for location
func (*LocationRewrite) Diff ¶
func (lr *LocationRewrite) Diff(anotherLr *LocationRewrite) bool
Diff judge anotherLr LocationRewrite is the same with lr LocationRewrite
type LocationSessionPersistence ¶
type LocationSessionPersistence struct { Type string `json:"type"` CookieTimeMode int `json:"cookietime_mode"` Timeout int `json:"timeout"` CookieKey string `json:"cookie_key"` }
LocationSessionPersistence sesseion for location
func (*LocationSessionPersistence) Diff ¶
func (lsp *LocationSessionPersistence) Diff(anotherLsp *LocationSessionPersistence) bool
Diff judge if anotherLsp LocationSessionPersistence is the same with lsp LocationSessionPersistence
type MockClient ¶
type MockClient struct {
// contains filtered or unexported fields
}
MockClient mock gw client
func (*MockClient) Delete ¶
func (mc *MockClient) Delete(svcs []*Service) error
Delete implements interface
func (*MockClient) Update ¶
func (mc *MockClient) Update(svcs []*Service) error
Update implements interface
type RealServer ¶
type RealServer struct { IP string `json:"rs_ip"` Port int `json:"rs_port"` VpcID int `json:"vpcid,omitempty"` HostIP string `json:"host_ip,omitempty"` Weight int `json:"rs_weight"` }
RealServer real server for location
func (*RealServer) Diff ¶
func (rs *RealServer) Diff(anotherRs *RealServer) bool
Diff judge anotherRs RealServer is the same with rs RealServer
type ServerInfo ¶
type ServerInfo struct { IP string `json:"ip"` Port uint `json:"port"` MetricPort uint `json:"metric_port"` HostName string `json:"hostname"` //http, https Scheme string `json:"scheme"` Version string `json:"version"` Cluster string `json:"cluster"` Pid int `json:"pid"` }
ServerInfo gw server information in zk path
type Service ¶
type Service struct { BizID string `json:"biz_id"` VIPList []string `json:"vip_list"` Domain string `json:"domain"` VPort int `json:"vport"` VpcID int `json:"vpcid,omitempty"` // optional, just for private network loadbalance Type string `json:"type,omitempty"` // optional, HTTP default, HTTP or HTTPS SSLEnable bool `json:"ssl_enable,omitempty"` // optional, must be true for HTTPS SSLVerifyClientEnable bool `json:"ssl_verify_client_enable,omitempty"` // optional CertID string `json:"cert_id,omitempty"` DefaultServer bool `json:"default_server"` ServerCustomizedConf string `json:"server_customized_conf,omitempty"` VIPProtoLimitRate int `json:"vip_proto_limit_rate,omitempty"` // speed limit value VIPProtoLimitStatusCode int `json:"vip_proto_limit_status_code,omitempty"` // speed limit status code VSLimitRate int `json:"vs_limit_rate,omitempty"` VSLimitStatusCode int `json:"vs_limit_status_code,omitempty"` LocationList []*Location `json:"location_list,omitempty"` }
Service service list
func NewServiceWithoutLocationList ¶
NewServiceWithoutLocationList new Service obj with empty location list
type UpdateRequest ¶
UpdateRequest request for sync gw services
type UpdateResponse ¶
type UpdateResponse struct {
Response
}
UpdateResponse response for sync gw services