diff --git a/internal/ingress/annotations/canary/main.go b/internal/ingress/annotations/canary/main.go index bfa8c53c..4c4d2507 100644 --- a/internal/ingress/annotations/canary/main.go +++ b/internal/ingress/annotations/canary/main.go @@ -19,24 +19,102 @@ package canary import ( networking "k8s.io/api/networking/v1" + "k8s.io/klog" "k8s.io/ingress-nginx/internal/ingress/annotations/parser" "k8s.io/ingress-nginx/internal/ingress/errors" "k8s.io/ingress-nginx/internal/ingress/resolver" ) +const ( + // A list of routing priority for canary ingresses + CanaryPriorityList = "canary-priority-list" + // Enable or disable canary ingress + CanaryFlag = "canary" + // Canary routing based on header with value 'always' + CanaryByHeader = "canary-by-header" + // Canary routing based on header with specific values + // Format:
[||
]* + // Default max number of header value is 20 + CanaryByHeaderVal = "canary-by-header-value" + // Canary routing based on cookie with value 'always' + CanaryByCookie = "canary-by-cookie" + // Canary routing based on cookie with specific values + // Format: [||]* + // Default max number cookie value is 20 + CanaryByCookieVal = "canary-by-cookie-value" + // Canary routing based on query with value 'always' + CanaryByQuery = "canary-by-query" + // Canary routing based on query with specific values + // Format: [||]* + // Default max number query value is 20 + CanaryByQueryVal = "canary-by-query-value" + // Mod divisor + CanaryModDivisor = "canary-mod-divisor" + // Mod relational operator + CanaryModRelationalOpr = "canary-mod-relational-operator" + // Mod remainder + CanaryModRemainder = "canary-mod-remainder" + // Canary weight + // range: [0, CanaryWeightTotal] + CanaryWeight = "canary-weight" + // canary weight total + // Default range: [100, 10000] + CanaryWeightTotal = "canary-weight-total" + // Add header to request based on canary ingress + // Format:
:
[||
:
]* + // Default max number header is 2 + // If the header is present on the request, the header and value will be added to the request again. + CanaryReqAddHeader = "canary-request-add-header" + // Append header value to request header based on canary ingress + // Format:
:
[||
:
]* + // Default max number header is 2 + // If the header is not present on the request, the header will be added to the request. + CanaryReqAppendHeader = "canary-request-append-header" + // Add query to request based on canary ingress + // Format: =[&=]* + // Default max number query is 2 + // If the query is present on the request, the query and value will be added to the request again. + CanaryReqAddQuery = "canary-request-add-query" + // Add header to response based on canary ingress + // Format:
:
[||
:
]* + // Default max number header is 2 + // If the header is present on the request, the header and value will be added to the response again. + CanaryRespAddHeader = "canary-response-add-header" + // Append header value to response header based on canary ingress + // Format:
:
[||
:
]* + // Default max number header is 2 + // If the header is not present on the request, the header will be added to the response. + CanaryRespAppendHeader = "canary-response-append-header" + // Referrer of canary ingress + CanaryReferrer = "canary-referrer" +) + type canary struct { r resolver.Resolver } // Config returns the configuration rules for setting up the Canary type Config struct { - Enabled bool - Weight int - Header string - HeaderValue string - Cookie string - Referrer string + Enabled bool + Weight int + WeightTotal int + Header string + HeaderValue string + Cookie string + CookieValue string + Query string + QueryValue string + ModDivisor int + ModRelationalOpr string + ModRemainder int + ReqAddHeader string + ReqAppendHeader string + ReqAddQuery string + RespAddHeader string + RespAppendHeader string + Priority string + Referrer string } // NewParser parses the ingress for canary related annotations @@ -50,39 +128,117 @@ func (c canary) Parse(ing *networking.Ingress) (interface{}, error) { config := &Config{} var err error - config.Enabled, err = parser.GetBoolAnnotation("canary", ing) + config.Enabled, err = parser.GetBoolAnnotation(CanaryFlag, ing) if err != nil { config.Enabled = false } - config.Weight, err = parser.GetIntAnnotation("canary-weight", ing) + config.Weight, err = parser.GetIntAnnotation(CanaryWeight, ing) if err != nil { config.Weight = 0 } - config.Header, err = parser.GetStringAnnotation("canary-by-header", ing) + config.WeightTotal, err = parser.GetIntAnnotation(CanaryWeightTotal, ing) + if err != nil { + config.WeightTotal = 100 + } + + config.Header, err = parser.GetStringAnnotation(CanaryByHeader, ing) if err != nil { config.Header = "" } - config.HeaderValue, err = parser.GetStringAnnotation("canary-by-header-value", ing) + config.HeaderValue, err = parser.GetStringAnnotation(CanaryByHeaderVal, ing) if err != nil { config.HeaderValue = "" } - config.Cookie, err = parser.GetStringAnnotation("canary-by-cookie", ing) + config.Cookie, err = parser.GetStringAnnotation(CanaryByCookie, ing) if err != nil { config.Cookie = "" } - config.Referrer, err = parser.GetStringAnnotation("canary-referrer", ing) + config.CookieValue, err = parser.GetStringAnnotation(CanaryByCookieVal, ing) + if err != nil { + config.CookieValue = "" + } + + config.Query, err = parser.GetStringAnnotation(CanaryByQuery, ing) + if err != nil { + config.Query = "" + } + + config.QueryValue, err = parser.GetStringAnnotation(CanaryByQueryVal, ing) + if err != nil { + config.QueryValue = "" + } + + config.ModDivisor, err = parser.GetIntAnnotation(CanaryModDivisor, ing) + if err != nil { + config.ModDivisor = 0 + } + + config.ModRelationalOpr, err = parser.GetStringAnnotation(CanaryModRelationalOpr, ing) + if err != nil { + config.ModRelationalOpr = "" + } + + config.ModRemainder, err = parser.GetIntAnnotation(CanaryModRemainder, ing) + if err != nil { + config.ModRemainder = 0 + } + + config.ReqAddHeader, err = parser.GetStringAnnotation(CanaryReqAddHeader, ing) + if err != nil { + config.ReqAddHeader = "" + } + + config.ReqAppendHeader, err = parser.GetStringAnnotation(CanaryReqAppendHeader, ing) + if err != nil { + config.ReqAppendHeader = "" + } + + config.ReqAddQuery, err = parser.GetStringAnnotation(CanaryReqAddQuery, ing) + if err != nil { + config.ReqAddQuery = "" + } + + config.RespAddHeader, err = parser.GetStringAnnotation(CanaryRespAddHeader, ing) + if err != nil { + config.RespAddHeader = "" + } + + config.RespAppendHeader, err = parser.GetStringAnnotation(CanaryRespAppendHeader, ing) + if err != nil { + config.RespAppendHeader = "" + } + + config.Referrer, err = parser.GetStringAnnotation(CanaryReferrer, ing) if err != nil { config.Referrer = "" } - if !config.Enabled && (config.Weight > 0 || len(config.Header) > 0 || len(config.HeaderValue) > 0 || len(config.Cookie) > 0) { + config.Priority, err = parser.GetStringAnnotation(CanaryPriorityList, ing) + if err != nil { + config.Priority = "" + } + + if !config.Enabled && + (config.Weight > 0 || + len(config.Header) > 0 || + len(config.HeaderValue) > 0 || + len(config.Cookie) > 0 || + len(config.CookieValue) > 0 || + len(config.Query) > 0 || + len(config.QueryValue) > 0) { + klog.Warningf("Canary ingress[%v/%v] configured but not enabled, ignored", ing.Namespace, ing.Name) return nil, errors.NewInvalidAnnotationConfiguration("canary", "configured but not enabled") } + if config.Enabled && len(config.Referrer) == 0 { + klog.Warningf("Canary ingress[%v/%v] with empty referrer, ignored", ing.Namespace, ing.Name) + return nil, errors.NewInvalidAnnotationConfiguration("canary", "referrer is empty") + } + return config, nil } diff --git a/internal/ingress/controller/config/config.go b/internal/ingress/controller/config/config.go index ccc0bc8b..10a737d3 100644 --- a/internal/ingress/controller/config/config.go +++ b/internal/ingress/controller/config/config.go @@ -674,9 +674,6 @@ type Configuration struct { // File path of status tengine StatusTengineFilePath string `json:"filepath-status-tengine"` - // Max canary ingress number - MaxCanaryIngNum int `json:"max-canary-ing-num"` - // Canary referrer: this is a multi-valued field, separated by ',' CanaryReferrer string `json:"canary-referrer"` @@ -718,6 +715,45 @@ type Configuration struct { // Default HTTP3/XQUIC port for clients HTTP3xQUICDefaultPort int `json:"http3-xquic-default-port"` + // Max number of path for the same host + MaxHostPathNum int `json:"max-host-path-num"` + + // Max canary ingress number + MaxCanaryIngNum int `json:"max-canary-ing-num"` + + // Max number of action for canary ingress with header and query + MaxCanaryActionNum int `json:"max-canary-action-num"` + + // The default total weight of traffic + DefaultCanaryWeightTotal uint32 `json:"default-canary-weight-total"` + + // The max total weight of traffic + MaxCanaryWeightTotal uint32 `json:"max-canary-weight-total"` + + // Max number of header value for canary annotation 'canary-by-header-value' + MaxCanaryHeaderValNum int `json:"max-canary-header-val-num"` + + // Max number of cookie value for canary annotation 'canary-by-cookie-value' + MaxCanaryCookieValNum int `json:"max-canary-cookie-val-num"` + + // Max number of query value for canary annotation 'canary-by-query-value' + MaxCanaryQueryValNum int `json:"max-canary-query-val-num"` + + // Max number of adding fields to the request header for canary annotation 'canary-request-add-header' + MaxReqAddHeaderNum int `json:"max-canary-req-add-header-num"` + + // Max number of appending fields to the request header for canary annotation 'canary-request-append-header' + MaxReqAppendHeaderNum int `json:"max-canary-req-append-header-num"` + + // Max number of adding fields to the request query for canary annotation 'canary-request-add-query' + MaxReqAddQueryNum int `json:"max-canary-req-add-query-num"` + + // Max number of adding fields to the response header for canary annotation 'canary-response-add-header' + MaxRespAddHeaderNum int `json:"max-canary-resp-add-header-num"` + + // Max number of appending fields to the response header for canary annotation 'canary-response-append-header' + MaxRespAppendHeaderNum int `json:"max-canary-resp-append-header-num"` + // Set user of Tengine worker processes User string `json:"user"` } @@ -870,7 +906,6 @@ func NewDefault() Configuration { TengineStaticServiceCfg: false, ShmServiceCfgFileLock: "/etc/nginx/shm_service_cfg.lock", StatusTengineFilePath: "/etc/nginx/htdocs/status.tengine", - MaxCanaryIngNum: 200, CanaryReferrer: "", IngressReferrer: "", UseCustomDefBackend: true, @@ -884,6 +919,19 @@ func NewDefault() Configuration { HTTP3xQUICDefaultCert: "", HTTP3xQUICDefaultKey: "", HTTP3xQUICDefaultPort: 443, + MaxHostPathNum: 20, + MaxCanaryIngNum: 20, + MaxCanaryActionNum: 10, + DefaultCanaryWeightTotal: 100, + MaxCanaryWeightTotal: 10000, + MaxCanaryHeaderValNum: 20, + MaxCanaryCookieValNum: 20, + MaxCanaryQueryValNum: 20, + MaxReqAddHeaderNum: 2, + MaxReqAppendHeaderNum: 2, + MaxReqAddQueryNum: 2, + MaxRespAddHeaderNum: 2, + MaxRespAppendHeaderNum: 2, User: "root", } diff --git a/internal/ingress/controller/controller.go b/internal/ingress/controller/controller.go index ea36ed93..23613bb4 100644 --- a/internal/ingress/controller/controller.go +++ b/internal/ingress/controller/controller.go @@ -836,12 +836,7 @@ func (n *NGINXController) createUpstreams(data []*ingress.Ingress, du *ingress.B // configure traffic shaping for canary if anns.Canary.Enabled && n.verifyCanaryReferrer(ingKey, anns) { upstreams[defBackend].NoServer = true - upstreams[defBackend].TrafficShapingPolicy = ingress.TrafficShapingPolicy{ - Weight: anns.Canary.Weight, - Header: anns.Canary.Header, - HeaderValue: anns.Canary.HeaderValue, - Cookie: anns.Canary.Cookie, - } + setTrafficShapingPolicy(anns, &upstreams[defBackend].TrafficShapingPolicy) } if len(upstreams[defBackend].Endpoints) == 0 { @@ -904,13 +899,8 @@ func (n *NGINXController) createUpstreams(data []*ingress.Ingress, du *ingress.B // configure traffic shaping for canary if anns.Canary.Enabled && n.verifyCanaryReferrer(ingKey, anns) { - upstreams[name].NoServer = true - upstreams[name].TrafficShapingPolicy = ingress.TrafficShapingPolicy{ - Weight: anns.Canary.Weight, - Header: anns.Canary.Header, - HeaderValue: anns.Canary.HeaderValue, - Cookie: anns.Canary.Cookie, - } + upstreams[svcName].NoServer = true + setTrafficShapingPolicy(anns, &upstreams[svcName].TrafficShapingPolicy) } if len(upstreams[name].Endpoints) == 0 { @@ -1646,3 +1636,23 @@ func (n *NGINXController) verifyCanaryReferrer(ingKey string, anns *annotations. klog.Warningf("Canary ingress[%v] with referrer [%v] is illegal, ignored", ingKey, anns.Canary.Referrer) return false } + +func setTrafficShapingPolicy(anns *annotations.Ingress, policy *ingress.TrafficShapingPolicy) { + *policy = ingress.TrafficShapingPolicy{ + Weight: anns.Canary.Weight, + Header: anns.Canary.Header, + HeaderValue: anns.Canary.HeaderValue, + Cookie: anns.Canary.Cookie, + CookieValue: anns.Canary.CookieValue, + Query: anns.Canary.Query, + QueryValue: anns.Canary.QueryValue, + ModDivisor: uint64(anns.Canary.ModDivisor), + ModRelationalOpr: anns.Canary.ModRelationalOpr, + ModRemainder: uint64(anns.Canary.ModRemainder), + ReqAddHeader: anns.Canary.ReqAddHeader, + ReqAppendHeader: anns.Canary.ReqAppendHeader, + ReqAddQuery: anns.Canary.ReqAddQuery, + RespAddHeader: anns.Canary.RespAddHeader, + RespAppendHeader: anns.Canary.RespAppendHeader, + } +} diff --git a/internal/ingress/controller/hotreload.go b/internal/ingress/controller/hotreload.go index ecf91295..52d94cbd 100644 --- a/internal/ingress/controller/hotreload.go +++ b/internal/ingress/controller/hotreload.go @@ -72,8 +72,10 @@ const ( ) const ( - // The default total weight of traffic - DefaultTotalWeightTraffic = 100 + // Min value of mod divisor + MinModDivisor = 2 + // Max value of mod divisor + MaxModDivisor = 100 ) const ( @@ -131,6 +133,30 @@ const ( Canary = "Canary" // Default value of Header and cookie Always = "always" + // Separator of canary annotation + //
[||
]* + // [||]* + // [||]* + //
:
[||
:
]* + CanaryDelimiter = "||" + // URL query parameter separator + QueryDelimiter = "&" + // URL query value separator + QueryValDelimiter = "=" + // Header field consists of a name followed by a colon (":") and the field value + HeaderDelimiter = ":" + // Nginx variable '&' + NginxVar = "$" + // Mod relational operator '>' + ModOperGreater = ">" + // Mod relational operator '>=' + ModOperGreaterEqual = ">=" + // Mod relational operator '<' + ModOperLess = "<" + // Mod relational operator '<=' + ModOperLessEqual = "<=" + // Mod relational operator '==' + ModOperEqual = "==" ) var ( @@ -224,75 +250,95 @@ func createHotCfg(cfg ngx_config.Configuration, ingressCfg ingress.Configuration if server.Hostname == DefServerName { continue } - rootServiceName := server.Hostname + RootLocation - paths := make([]*route.PathRouter, 0, len(server.Locations)) - for _, loc := range server.Locations { - upsService := loc.Service - pathServiceName := server.Hostname + loc.Path - if upsService == nil { - continue - } - service := createVirtualService(loc.Backend, loc, pathServiceName, server) - path := &route.PathRouter{ - Path: loc.Path, - ServiceName: pathServiceName, - } - if len(loc.Canaries) > 0 { - tags := make([]*route.TagRouter, 0, len(loc.Canaries)) - canaryUps := make([]*route.Upstream, 0, len(loc.Canaries)) - for i, canary := range loc.Canaries { - if i == cfg.MaxCanaryIngNum { - klog.Errorf("Loc[%v%v] exceeds the canary limit [%v], ignored", - server.Hostname, loc.Path, cfg.MaxCanaryIngNum) - break - } - canaryService := &route.VirtualService{} - tagRouter := &route.TagRouter{} - policy := canary.TrafficShapingPolicy - if len(policy.Header) > 0 { - canaryService, tagRouter = createHeaderCanary(cfg, i, server, loc, canary) - tags = append(tags, tagRouter) - services = append(services, canaryService) - } else if policy.Weight > 0 { - canaryUpstream := createWeightCanary(server, loc, canary) - canaryUps = append(canaryUps, canaryUpstream) - } else { - klog.Errorf("Loc[%v%v] canary[header=%v,headerval=%v,weight=%v] is invalid, ignored", - server.Hostname, loc.Path, policy.Header, policy.HeaderValue, policy.Weight) - continue - } - } + var ingType route.HostType = route.Web + var router *route.Router + router = createHostRouter(cfg, ingType, server, &services) + routers = append(routers, router) + } - path.Tags = tags - upstreamWeight(canaryUps, service) - } - paths = append(paths, path) - services = append(services, service) + return &route.Config{ + Routers: routers, + Services: services, + } +} + +func createHostRouter(cfg ngx_config.Configuration, ingType route.HostType, server *ingress.Server, services *[]*route.VirtualService) *route.Router { + rootServiceName := server.Hostname + RootLocation + paths := make([]*route.PathRouter, 0, len(server.Locations)) + + for _, loc := range server.Locations { + upsService := loc.Service + pathServiceName := server.Hostname + loc.Path + if upsService == nil { + continue } - hostRouter := &route.HostRouter{ - Host: server.Hostname, - ServiceName: rootServiceName, - Paths: paths, + service := createVirtualService(cfg, loc.Backend, loc, pathServiceName, server) + path := &route.PathRouter{ + Prefix: loc.Path, + ServiceName: pathServiceName, } - router := &route.Router{ - HostRouter: hostRouter, + if len(loc.Canaries) > 0 { + tags := make([]*route.TagRouter, 0, len(loc.Canaries)) + canaryUps := make([]*route.Upstream, 0, len(loc.Canaries)) + setCanaryPriority(&loc.Canaries) + for i, canary := range loc.Canaries { + if i == cfg.MaxCanaryIngNum { + klog.Errorf("Loc[%v%v] exceeds the canary limit [%v], ignored", + server.Hostname, loc.Path, cfg.MaxCanaryIngNum) + break + } + canaryService := &route.VirtualService{} + tagRouter := &route.TagRouter{} + policy := canary.TrafficShapingPolicy + if len(policy.Header) > 0 { + canaryService, tagRouter = createHeaderCanary(i, cfg, server, loc, canary) + tags = append(tags, tagRouter) + *services = append(*services, canaryService) + } else if len(policy.Cookie) > 0 { + canaryService, tagRouter = createCookieCanary(i, cfg, server, loc, canary) + tags = append(tags, tagRouter) + *services = append(*services, canaryService) + } else if len(policy.Query) > 0 { + canaryService, tagRouter = createQueryCanary(i, cfg, server, loc, canary) + tags = append(tags, tagRouter) + *services = append(*services, canaryService) + } else if policy.Weight > 0 { + canaryUpstream := createWeightCanary(server, loc, canary) + canaryUps = append(canaryUps, canaryUpstream) + } else { + klog.Errorf("Loc[%v%v] canary is invalid, ignored", server.Hostname, loc.Path) + continue + } + } + + path.Tags = tags + upstreamWeight(cfg, canaryUps, loc, service) } - routers = append(routers, router) + paths = append(paths, path) + *services = append(*services, service) } - return &route.Config{ - Routers: routers, - Services: services, + hostRouter := &route.HostRouter{ + Host: server.Hostname, + ServiceName: rootServiceName, + Paths: paths, + Type: ingType, } + + router := &route.Router{ + HostRouter: hostRouter, + } + + return router } -func createVirtualService(target string, loc *ingress.Location, serviceName string, server *ingress.Server) *route.VirtualService { +func createVirtualService(cfg ngx_config.Configuration, target string, loc *ingress.Location, serviceName string, server *ingress.Server) *route.VirtualService { upstream := &route.Upstream{ Target: target, - Weight: DefaultTotalWeightTraffic, + Weight: cfg.DefaultCanaryWeightTotal, } timeout := &route.Timeout{ @@ -380,28 +426,184 @@ func createMetaData(server *ingress.Server, loc *ingress.Location) []*route.Meta } } -func createHeaderCanary(cfg ngx_config.Configuration, seq int, server *ingress.Server, loc *ingress.Location, canary *ingress.Canary) (*route.VirtualService, *route.TagRouter) { - canaryService := &route.VirtualService{} - tagRouter := &route.TagRouter{} +func getValType(str string) route.ActionValueType { + if strings.HasPrefix(str, NginxVar) { + return route.ActionDynamicValue + } + + return route.ActionStaticValue +} + +func getVal(valType route.ActionValueType, str string) string { + if valType == route.ActionDynamicValue { + return strings.TrimPrefix(str, NginxVar) + } + + return str +} + +func createAction(maxActionNum int, actionType route.ActionType, canaryDelimiter string, itemDelimiter string, policyRule string, canary *ingress.Canary, service *route.VirtualService, actions *[]*route.Action) { + policies := strings.Split(policyRule, canaryDelimiter) + num := 0 + for _, policy := range policies { + if policy == "" { + klog.V(3).Infof("Policy rule for action is empty") + continue + } + + klog.V(3).Infof("Policy rule for action is [%v]", policy) + itmes := strings.Split(policy, itemDelimiter) + if len(itmes) == 2 && len(itmes[0]) > 0 && len(itmes[1]) > 0 { + if num == maxActionNum { + klog.Errorf("Service [%v] with backend [%v] exceeds the action [%v] limit [%v], [%v%v%v] ignored", + service.ServiceName, canary.Target, actionType, maxActionNum, itmes[0], itemDelimiter, itmes[1]) + break + } + + valType := getValType(itmes[1]) + val := getVal(valType, itmes[1]) + action := &route.Action{ + ActionType: actionType, + ValueType: valType, + Key: itmes[0], + Value: val, + } + + *actions = append(*actions, action) + num++ + } + } +} + +func createActions(cfg ngx_config.Configuration, canary *ingress.Canary, service *route.VirtualService) { policy := canary.TrafficShapingPolicy + exist := len(policy.ReqAddHeader) + len(policy.ReqAppendHeader) + len(policy.ReqAddQuery) + len(policy.RespAddHeader) + len(policy.RespAppendHeader) + if exist == 0 { + return + } + + actions := make([]*route.Action, 0, cfg.MaxCanaryActionNum) + if len(policy.ReqAddHeader) > 0 { + createAction(cfg.MaxReqAddHeaderNum, route.ActionAddReqHeader, CanaryDelimiter, HeaderDelimiter, policy.ReqAddHeader, canary, service, &actions) + } + if len(policy.ReqAppendHeader) > 0 { + createAction(cfg.MaxReqAppendHeaderNum, route.ActionAppendReqHeader, CanaryDelimiter, HeaderDelimiter, policy.ReqAppendHeader, canary, service, &actions) + } + if len(policy.ReqAddQuery) > 0 { + createAction(cfg.MaxReqAddQueryNum, route.ActionAddParam, QueryDelimiter, QueryValDelimiter, policy.ReqAddQuery, canary, service, &actions) + } + if len(policy.RespAddHeader) > 0 { + createAction(cfg.MaxRespAddHeaderNum, route.ActionAddRespHeader, CanaryDelimiter, HeaderDelimiter, policy.RespAddHeader, canary, service, &actions) + } + if len(policy.RespAppendHeader) > 0 { + createAction(cfg.MaxRespAppendHeaderNum, route.ActionAppendRespHeader, CanaryDelimiter, HeaderDelimiter, policy.RespAppendHeader, canary, service, &actions) + } + + service.Action = actions +} + +func checkModDivisor(modDivisor uint64) bool { + if modDivisor >= MinModDivisor && modDivisor <= MaxModDivisor { + return true + } + + return false +} + +func checkModRemainder(modDivisor uint64, modRemainder uint64) bool { + if modRemainder >= 0 && modRemainder < modDivisor { + return true + } + + return false +} + +func getModOper(modOpr string) (bool, route.OperatorType) { + if modOpr == ModOperEqual { + return true, route.OperatorEqual + } else if modOpr == ModOperGreater { + return true, route.OperatorGreater + } else if modOpr == ModOperGreaterEqual { + return true, route.OperatorGreaterEqual + } else if modOpr == ModOperLess { + return true, route.OperatorLess + } else if modOpr == ModOperLessEqual { + return true, route.OperatorLessEqual + } else { + klog.Warningf("Mod operator [%v] is invalid", modOpr) + return false, route.OperatorUnDefined + } +} - headerValue := "" - if len(policy.HeaderValue) > 0 { - headerValue = policy.HeaderValue +func getMatchType(policyRule string, policy ingress.TrafficShapingPolicy) (route.OperatorType, route.MatchType) { + ret := false + modOpr := route.OperatorUnDefined + matchType := route.WholeMatch + modDivisor := policy.ModDivisor + modRelationalOpr := policy.ModRelationalOpr + modRemainder := policy.ModRemainder + + if len(policyRule) > 0 { + matchType = route.StrListInMatch + } else if checkModDivisor(modDivisor) && checkModRemainder(modDivisor, modRemainder) { + ret, modOpr = getModOper(modRelationalOpr) + if ret { + matchType = route.ModCompare + } + } + + return modOpr, matchType +} + +func getTagItem(policyRule string, maxValNum int, policy ingress.TrafficShapingPolicy) (route.MatchType, *route.TagItemCondition) { + condition := &route.TagItemCondition{} + operType, matchType := getMatchType(policyRule, policy) + + if matchType == route.ModCompare { + condition.Divisor = policy.ModDivisor + condition.Remainder = policy.ModRemainder + condition.Operator = operType + } else if matchType == route.StrListInMatch { + strList := &route.TagValueStrList{} + items := strings.Split(policyRule, CanaryDelimiter) + num := 0 + for _, item := range items { + if item == "" { + continue + } + if num == maxValNum { + klog.Errorf("Policy[%v] exceeds the value limit [%v], [%v] ignored", + policyRule, maxValNum, item) + break + } + strList.Value = append(strList.Value, item) + num++ + } + condition.ValueList = strList } else { - headerValue = Always + condition.ValueStr = Always } + return matchType, condition +} + +func createCanary(seq int, locType route.LocationType, routeKey string, policyRule string, maxValNum int, cfg ngx_config.Configuration, server *ingress.Server, loc *ingress.Location, canary *ingress.Canary) (*route.VirtualService, *route.TagRouter) { + canaryService := &route.VirtualService{} + tagRouter := &route.TagRouter{} + policy := canary.TrafficShapingPolicy + condition := &route.TagItemCondition{} + matchType := route.MatchUnDefined + pathCanaryServiceName := server.Hostname + loc.Path + Canary + strconv.Itoa(seq) - klog.Infof("Loc[%v%v], canary[%v], header=[%v], value=[%v]", - server.Hostname, loc.Path, pathCanaryServiceName, policy.Header, headerValue) - canaryService = createVirtualService(canary.Target, loc, pathCanaryServiceName, server) + canaryService = createVirtualService(cfg, canary.Target, loc, pathCanaryServiceName, server) + createActions(cfg, canary, canaryService) + matchType, condition = getTagItem(policyRule, maxValNum, policy) tagItem := &route.TagItem{ - Location: route.LocHttpHeader, - Key: policy.Header, - Value: headerValue, - MatchType: route.WholeMatch, + Location: locType, + Key: routeKey, + Condition: condition, + MatchType: matchType, } tagRule := &route.TagRule{ @@ -420,6 +622,30 @@ func createHeaderCanary(cfg ngx_config.Configuration, seq int, server *ingress.S return canaryService, tagRouter } +func createHeaderCanary(seq int, cfg ngx_config.Configuration, server *ingress.Server, loc *ingress.Location, canary *ingress.Canary) (*route.VirtualService, *route.TagRouter) { + policy := canary.TrafficShapingPolicy + klog.Infof("Loc[%v%v], header=[%v], value=[%v], modDivisor=[%v], modOpr=[%v], modRemainder=[%v]", + server.Hostname, loc.Path, policy.Header, policy.HeaderValue, policy.ModDivisor, policy.ModRelationalOpr, policy.ModRemainder) + + return createCanary(seq, route.LocHttpHeader, policy.Header, policy.HeaderValue, cfg.MaxCanaryHeaderValNum, cfg, server, loc, canary) +} + +func createCookieCanary(seq int, cfg ngx_config.Configuration, server *ingress.Server, loc *ingress.Location, canary *ingress.Canary) (*route.VirtualService, *route.TagRouter) { + policy := canary.TrafficShapingPolicy + klog.Infof("Loc[%v%v], cookie=[%v], value=[%v], modDivisor=[%v], modOpr=[%v], modRemainder=[%v]", + server.Hostname, loc.Path, policy.Cookie, policy.CookieValue, policy.ModDivisor, policy.ModRelationalOpr, policy.ModRemainder) + + return createCanary(seq, route.LocHttpCookie, policy.Cookie, policy.CookieValue, cfg.MaxCanaryCookieValNum, cfg, server, loc, canary) +} + +func createQueryCanary(seq int, cfg ngx_config.Configuration, server *ingress.Server, loc *ingress.Location, canary *ingress.Canary) (*route.VirtualService, *route.TagRouter) { + policy := canary.TrafficShapingPolicy + klog.Infof("Loc[%v%v], query=[%v], value=[%v], modDivisor=[%v], modOpr=[%v], modRemainder=[%v]", + server.Hostname, loc.Path, policy.Query, policy.QueryValue, policy.ModDivisor, policy.ModRelationalOpr, policy.ModRemainder) + + return createCanary(seq, route.LocHttpQuery, policy.Query, policy.QueryValue, cfg.MaxCanaryQueryValNum, cfg, server, loc, canary) +} + func createWeightCanary(server *ingress.Server, loc *ingress.Location, canary *ingress.Canary) *route.Upstream { upstream := &route.Upstream{ Target: canary.Target, @@ -431,7 +657,8 @@ func createWeightCanary(server *ingress.Server, loc *ingress.Location, canary *i return upstream } -func upstreamWeight(canaryUps []*route.Upstream, service *route.VirtualService) { +func upstreamWeight(cfg ngx_config.Configuration, canaryUps []*route.Upstream, loc *ingress.Location, service *route.VirtualService) { + var totalWeightTraffic uint32 = 0 var canaryWeightSum uint32 = 0 upstreams := make([]*route.Upstream, 0, len(canaryUps)) for _, canaryUp := range canaryUps { @@ -439,10 +666,18 @@ func upstreamWeight(canaryUps []*route.Upstream, service *route.VirtualService) upstreams = append(upstreams, canaryUp) } - srvWeight := DefaultTotalWeightTraffic - canaryWeightSum + totalWeightTraffic = uint32(loc.WeightTotal) + if totalWeightTraffic < cfg.DefaultCanaryWeightTotal || totalWeightTraffic > cfg.MaxCanaryWeightTotal { + klog.Errorf("Total weight [%v] of canary traffic [%v] exceeds limit [%v,%v], use default[%v]", + totalWeightTraffic, service.ServiceName, cfg.DefaultCanaryWeightTotal, + cfg.MaxCanaryWeightTotal, cfg.DefaultCanaryWeightTotal) + totalWeightTraffic = cfg.DefaultCanaryWeightTotal + } + + srvWeight := totalWeightTraffic - canaryWeightSum if srvWeight < 0 { klog.Errorf("Total weight [%v] of canary traffic [%v] is larger than [%v]", - canaryWeightSum, service.ServiceName, DefaultTotalWeightTraffic) + canaryWeightSum, service.ServiceName, totalWeightTraffic) } else { service.Upstreams[0].Weight = srvWeight klog.Infof("The weight of traffic [%v] is [%v]", @@ -491,3 +726,46 @@ func createCorsOriginRegex(corsOrigins []string) string { return originsRegex } + +func setCanaryPriority(canaries *[]*ingress.Canary) { + headerCanaries := make([]*ingress.Canary, 0) + cookieCanaries := make([]*ingress.Canary, 0) + queryCanaries := make([]*ingress.Canary, 0) + weightCanaries := make([]*ingress.Canary, 0) + + for _, canary := range *canaries { + policy := canary.TrafficShapingPolicy + if len(policy.Header) > 0 { + headerCanaries = append(headerCanaries, canary) + } else if len(policy.Cookie) > 0 { + cookieCanaries = append(cookieCanaries, canary) + } else if len(policy.Query) > 0 { + queryCanaries = append(queryCanaries, canary) + } else if policy.Weight > 0 { + weightCanaries = append(weightCanaries, canary) + } else { + continue + } + } + + *canaries = (*canaries)[:0] + *canaries = append(*canaries, headerCanaries...) + *canaries = append(*canaries, cookieCanaries...) + *canaries = append(*canaries, queryCanaries...) + *canaries = append(*canaries, weightCanaries...) + + for _, canary := range *canaries { + policy := canary.TrafficShapingPolicy + klog.Infof("Canary priority: Header[%v],HeaderValue[%v],Cookie[%v],CookieValue[%v],Query[%v],QueryValue[%v],Weight[%v],ModDivisor[%v],ModRelationalOpr[%v],ModRemainder[%v]", + policy.Header, + policy.HeaderValue, + policy.Cookie, + policy.CookieValue, + policy.Query, + policy.QueryValue, + policy.Weight, + policy.ModDivisor, + policy.ModRelationalOpr, + policy.ModRemainder) + } +} diff --git a/internal/ingress/types.go b/internal/ingress/types.go index deedef37..c87492b5 100644 --- a/internal/ingress/types.go +++ b/internal/ingress/types.go @@ -116,9 +116,12 @@ type Backend struct { // alternative backend // +k8s:deepcopy-gen=true type TrafficShapingPolicy struct { - // Weight (0-100) of traffic to redirect to the backend. - // e.g. Weight 20 means 20% of traffic will be redirected to the backend and 80% will remain - // with the other backend. 0 weight will not send any traffic to this backend + // Weight (0-) of traffic to redirect to the backend. + // e.g. defaults to 100, weight 20 means 20% of traffic will be + // redirected to the backend and 80% will remain with the other backend. If + // is set to 1000, weight 2 means 0.2% of traffic will be + // redirected to the backend and 99.8% will remain with the other backend. + // 0 weight will not send any traffic to this backend Weight int `json:"weight"` // Header on which to redirect requests to this backend Header string `json:"header"` @@ -126,6 +129,28 @@ type TrafficShapingPolicy struct { HeaderValue string `json:"headerValue"` // Cookie on which to redirect requests to this backend Cookie string `json:"cookie"` + // CookieValue on which to redirect requests to this backend + CookieValue string `json:"cookieValue"` + // Query on on which to redirect requests to this backend + Query string `json:"query"` + // QueryValue on which to redirect requests to this backend + QueryValue string `json:"queryValue"` + // Mod divisor + ModDivisor uint64 `json:"modDivisor"` + // Mod relational operator + ModRelationalOpr string `json:"modRelationalOpr"` + // Mod remainder + ModRemainder uint64 `json:"modRemainder"` + // Add header to request based on canary ingress + ReqAddHeader string `json:"reqAddHeader"` + // Append header value to request header based on canary ingress + ReqAppendHeader string `json:"reqAppendHeader"` + // Add query to request based on canary ingress + ReqAddQuery string `json:"reqAddQuery"` + // Add header to response based on canary ingress + RespAddHeader string `json:"respAddHeader"` + // Append header value to response header based on canary ingress + RespAppendHeader string `json:"respAppendHeader"` } // HashInclude defines if a field should be used or not to calculate the hash @@ -362,6 +387,8 @@ type Location struct { DisableRobots bool `json:"disable-robots"` // Canaries describes the canary rules that will be used on the location Canaries []*Canary `json:"canaries"` + // Default range: [100, 10000] + WeightTotal int `json:"weightTotal"` // FastCGI allows the ingress to act as a FastCGI client for a given location. // +optional FastCGI fastcgi.Config `json:"fastcgi,omitempty"` diff --git a/internal/ingress/types_equals.go b/internal/ingress/types_equals.go index 3918cf66..50bb04fe 100644 --- a/internal/ingress/types_equals.go +++ b/internal/ingress/types_equals.go @@ -255,6 +255,39 @@ func (tsp1 TrafficShapingPolicy) Equal(tsp2 TrafficShapingPolicy) bool { if tsp1.Cookie != tsp2.Cookie { return false } + if tsp1.CookieValue != tsp2.CookieValue { + return false + } + if tsp1.Query != tsp2.Query { + return false + } + if tsp1.QueryValue != tsp2.QueryValue { + return false + } + if tsp1.ModDivisor != tsp2.ModDivisor { + return false + } + if tsp1.ModRelationalOpr != tsp2.ModRelationalOpr { + return false + } + if tsp1.ModRemainder != tsp2.ModRemainder { + return false + } + if tsp1.ReqAddHeader != tsp2.ReqAddHeader { + return false + } + if tsp1.ReqAppendHeader != tsp2.ReqAppendHeader { + return false + } + if tsp1.ReqAddQuery != tsp2.ReqAddQuery { + return false + } + if tsp1.RespAddHeader != tsp2.RespAddHeader { + return false + } + if tsp1.RespAppendHeader != tsp2.RespAppendHeader { + return false + } return true } @@ -448,15 +481,15 @@ func (l1 *Location) Equal(l2 *Location) bool { return false } - if l1.DisableRobots != l2.DisableRobots { + if l1.WeightTotal != l2.WeightTotal { return false } - if len(l1.Canaries) != len(l2.Canaries) { + if l1.DisableRobots != l2.DisableRobots { return false } - match := compareCanary(l1.Canaries, l2.Canaries) + match := compareCanaries(l1.Canaries, l2.Canaries) if !match { return false } @@ -493,24 +526,6 @@ func (l1 *Location) Equal(l2 *Location) bool { return true } -// Equal tests for equality between two Canary types -func (c1 *Canary) Equal(c2 *Canary) bool { - if c1 == c2 { - return true - } - if c1 == nil || c2 == nil { - return false - } - if c1.Target != c2.Target { - return false - } - if !c1.TrafficShapingPolicy.Equal(c2.TrafficShapingPolicy) { - return false - } - - return true -} - // Equal tests for equality between two SSLPassthroughBackend types func (ptb1 *SSLPassthroughBackend) Equal(ptb2 *SSLPassthroughBackend) bool { if ptb1 == ptb2 { @@ -685,20 +700,40 @@ func compareL4Service(a, b []L4Service) bool { return sets.Compare(a, b, compareL4ServiceFunc) } -var compareCanaryFunc = func(e1, e2 interface{}) bool { - b1, ok := e1.(Canary) +func (c1 *Canary) Equal(c2 *Canary) bool { + if c1 == c2 { + return true + } + + if c1 == nil || c2 == nil { + return false + } + + if c1.BackendTarget != c2.BackendTarget { + return false + } + + if !c1.TrafficShapingPolicy.Equal(c2.TrafficShapingPolicy) { + return false + } + + return true +} + +var compareCanariesFunc = func(e1, e2 interface{}) bool { + b1, ok := e1.(*Canary) if !ok { return false } - b2, ok := e2.(Canary) + b2, ok := e2.(*Canary) if !ok { return false } - return (&b1).Equal(&b2) + return b1.Equal(b2) } -func compareCanary(a, b []*Canary) bool { - return sets.Compare(a, b, compareCanaryFunc) +func compareCanaries(a, b []*Canary) bool { + return sets.Compare(a, b, compareCanariesFunc) } diff --git a/internal/route/route.pb.go b/internal/route/route.pb.go index 0e6c9a68..2868ba18 100644 --- a/internal/route/route.pb.go +++ b/internal/route/route.pb.go @@ -25,27 +25,85 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +type OperatorType int32 + +const ( + OperatorUnDefined OperatorType = 0 + OperatorEqual OperatorType = 1 + OperatorGreater OperatorType = 2 + OperatorLess OperatorType = 3 + OperatorGreaterEqual OperatorType = 4 + OperatorLessEqual OperatorType = 5 +) + +var OperatorType_name = map[int32]string{ + 0: "OperatorUnDefined", + 1: "OperatorEqual", + 2: "OperatorGreater", + 3: "OperatorLess", + 4: "OperatorGreaterEqual", + 5: "OperatorLessEqual", +} + +var OperatorType_value = map[string]int32{ + "OperatorUnDefined": 0, + "OperatorEqual": 1, + "OperatorGreater": 2, + "OperatorLess": 3, + "OperatorGreaterEqual": 4, + "OperatorLessEqual": 5, +} + +func (x OperatorType) Enum() *OperatorType { + p := new(OperatorType) + *p = x + return p +} + +func (x OperatorType) MarshalJSON() ([]byte, error) { + return proto.MarshalJSONEnum(OperatorType_name, int32(x)) +} + +func (x *OperatorType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(OperatorType_value, data, "OperatorType") + if err != nil { + return err + } + *x = OperatorType(value) + return nil +} + +func (OperatorType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_0984d49a362b6b9f, []int{0} +} + type LocationType int32 const ( - LocHttpHeader LocationType = 0 - LocHttpQuery LocationType = 1 - LocNginxVar LocationType = 2 - LocXBizInfo LocationType = 3 + LocUnDefined LocationType = 0 + LocHttpHeader LocationType = 1 + LocHttpQuery LocationType = 2 + LocNginxVar LocationType = 3 + LocXBizInfo LocationType = 4 + LocHttpCookie LocationType = 5 ) var LocationType_name = map[int32]string{ - 0: "LocHttpHeader", - 1: "LocHttpQuery", - 2: "LocNginxVar", - 3: "LocXBizInfo", + 0: "LocUnDefined", + 1: "LocHttpHeader", + 2: "LocHttpQuery", + 3: "LocNginxVar", + 4: "LocXBizInfo", + 5: "LocHttpCookie", } var LocationType_value = map[string]int32{ - "LocHttpHeader": 0, - "LocHttpQuery": 1, - "LocNginxVar": 2, - "LocXBizInfo": 3, + "LocUnDefined": 0, + "LocHttpHeader": 1, + "LocHttpQuery": 2, + "LocNginxVar": 3, + "LocXBizInfo": 4, + "LocHttpCookie": 5, } func (x LocationType) Enum() *LocationType { @@ -68,30 +126,30 @@ func (x *LocationType) UnmarshalJSON(data []byte) error { } func (LocationType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_0984d49a362b6b9f, []int{0} + return fileDescriptor_0984d49a362b6b9f, []int{1} } type MatchType int32 const ( - WholeMatch MatchType = 0 - PrefixMatch MatchType = 1 - SuffixMatch MatchType = 2 - RegMatch MatchType = 3 + MatchUnDefined MatchType = 0 + WholeMatch MatchType = 1 + StrListInMatch MatchType = 2 + ModCompare MatchType = 3 ) var MatchType_name = map[int32]string{ - 0: "WholeMatch", - 1: "PrefixMatch", - 2: "SuffixMatch", - 3: "RegMatch", + 0: "MatchUnDefined", + 1: "WholeMatch", + 2: "StrListInMatch", + 3: "ModCompare", } var MatchType_value = map[string]int32{ - "WholeMatch": 0, - "PrefixMatch": 1, - "SuffixMatch": 2, - "RegMatch": 3, + "MatchUnDefined": 0, + "WholeMatch": 1, + "StrListInMatch": 2, + "ModCompare": 3, } func (x MatchType) Enum() *MatchType { @@ -114,20 +172,273 @@ func (x *MatchType) UnmarshalJSON(data []byte) error { } func (MatchType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_0984d49a362b6b9f, []int{2} +} + +type HostType int32 + +const ( + Web HostType = 0 + MTOP HostType = 1 +) + +var HostType_name = map[int32]string{ + 0: "Web", + 1: "MTOP", +} + +var HostType_value = map[string]int32{ + "Web": 0, + "MTOP": 1, +} + +func (x HostType) Enum() *HostType { + p := new(HostType) + *p = x + return p +} + +func (x HostType) MarshalJSON() ([]byte, error) { + return proto.MarshalJSONEnum(HostType_name, int32(x)) +} + +func (x *HostType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(HostType_value, data, "HostType") + if err != nil { + return err + } + *x = HostType(value) + return nil +} + +func (HostType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_0984d49a362b6b9f, []int{3} +} + +type ActionType int32 + +const ( + ActionUnDefined ActionType = 0 + ActionAddReqHeader ActionType = 1 + ActionAppendReqHeader ActionType = 2 + ActionAddRespHeader ActionType = 3 + ActionAppendRespHeader ActionType = 4 + ActionAddParam ActionType = 5 +) + +var ActionType_name = map[int32]string{ + 0: "ActionUnDefined", + 1: "ActionAddReqHeader", + 2: "ActionAppendReqHeader", + 3: "ActionAddRespHeader", + 4: "ActionAppendRespHeader", + 5: "ActionAddParam", +} + +var ActionType_value = map[string]int32{ + "ActionUnDefined": 0, + "ActionAddReqHeader": 1, + "ActionAppendReqHeader": 2, + "ActionAddRespHeader": 3, + "ActionAppendRespHeader": 4, + "ActionAddParam": 5, +} + +func (x ActionType) Enum() *ActionType { + p := new(ActionType) + *p = x + return p +} + +func (x ActionType) MarshalJSON() ([]byte, error) { + return proto.MarshalJSONEnum(ActionType_name, int32(x)) +} + +func (x *ActionType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(ActionType_value, data, "ActionType") + if err != nil { + return err + } + *x = ActionType(value) + return nil +} + +func (ActionType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_0984d49a362b6b9f, []int{4} +} + +type ActionValueType int32 + +const ( + ActionValueUnDefined ActionValueType = 0 + ActionStaticValue ActionValueType = 1 + ActionDynamicValue ActionValueType = 2 +) + +var ActionValueType_name = map[int32]string{ + 0: "ActionValueUnDefined", + 1: "ActionStaticValue", + 2: "ActionDynamicValue", +} + +var ActionValueType_value = map[string]int32{ + "ActionValueUnDefined": 0, + "ActionStaticValue": 1, + "ActionDynamicValue": 2, +} + +func (x ActionValueType) Enum() *ActionValueType { + p := new(ActionValueType) + *p = x + return p +} + +func (x ActionValueType) MarshalJSON() ([]byte, error) { + return proto.MarshalJSONEnum(ActionValueType_name, int32(x)) +} + +func (x *ActionValueType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(ActionValueType_value, data, "ActionValueType") + if err != nil { + return err + } + *x = ActionValueType(value) + return nil +} + +func (ActionValueType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_0984d49a362b6b9f, []int{5} +} + +type TagValueStrList struct { + Value []string `protobuf:"bytes,1,rep,name=value" json:"value,omitempty"` +} + +func (m *TagValueStrList) Reset() { *m = TagValueStrList{} } +func (*TagValueStrList) ProtoMessage() {} +func (*TagValueStrList) Descriptor() ([]byte, []int) { + return fileDescriptor_0984d49a362b6b9f, []int{0} +} +func (m *TagValueStrList) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TagValueStrList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TagValueStrList.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TagValueStrList) XXX_Merge(src proto.Message) { + xxx_messageInfo_TagValueStrList.Merge(m, src) +} +func (m *TagValueStrList) XXX_Size() int { + return m.Size() +} +func (m *TagValueStrList) XXX_DiscardUnknown() { + xxx_messageInfo_TagValueStrList.DiscardUnknown(m) +} + +var xxx_messageInfo_TagValueStrList proto.InternalMessageInfo + +func (m *TagValueStrList) GetValue() []string { + if m != nil { + return m.Value + } + return nil +} + +type TagItemCondition struct { + ValueStr string `protobuf:"bytes,1,opt,name=value_str" json:"value_str"` + ValueList *TagValueStrList `protobuf:"bytes,2,opt,name=value_list" json:"value_list,omitempty"` + Divisor uint64 `protobuf:"varint,3,opt,name=divisor" json:"divisor"` + Remainder uint64 `protobuf:"varint,4,opt,name=remainder" json:"remainder"` + Operator OperatorType `protobuf:"varint,5,opt,name=operator,enum=route.OperatorType" json:"operator"` +} + +func (m *TagItemCondition) Reset() { *m = TagItemCondition{} } +func (*TagItemCondition) ProtoMessage() {} +func (*TagItemCondition) Descriptor() ([]byte, []int) { return fileDescriptor_0984d49a362b6b9f, []int{1} } +func (m *TagItemCondition) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TagItemCondition) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TagItemCondition.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TagItemCondition) XXX_Merge(src proto.Message) { + xxx_messageInfo_TagItemCondition.Merge(m, src) +} +func (m *TagItemCondition) XXX_Size() int { + return m.Size() +} +func (m *TagItemCondition) XXX_DiscardUnknown() { + xxx_messageInfo_TagItemCondition.DiscardUnknown(m) +} + +var xxx_messageInfo_TagItemCondition proto.InternalMessageInfo + +func (m *TagItemCondition) GetValueStr() string { + if m != nil { + return m.ValueStr + } + return "" +} + +func (m *TagItemCondition) GetValueList() *TagValueStrList { + if m != nil { + return m.ValueList + } + return nil +} + +func (m *TagItemCondition) GetDivisor() uint64 { + if m != nil { + return m.Divisor + } + return 0 +} + +func (m *TagItemCondition) GetRemainder() uint64 { + if m != nil { + return m.Remainder + } + return 0 +} + +func (m *TagItemCondition) GetOperator() OperatorType { + if m != nil { + return m.Operator + } + return OperatorUnDefined +} type TagItem struct { - Location LocationType `protobuf:"varint,1,opt,name=location,enum=route.LocationType" json:"location"` - Key string `protobuf:"bytes,2,opt,name=key" json:"key"` - Value string `protobuf:"bytes,3,opt,name=value" json:"value"` - MatchType MatchType `protobuf:"varint,4,opt,name=match_type,enum=route.MatchType" json:"match_type"` + Location LocationType `protobuf:"varint,1,opt,name=location,enum=route.LocationType" json:"location"` + Key string `protobuf:"bytes,2,opt,name=key" json:"key"` + Condition *TagItemCondition `protobuf:"bytes,3,opt,name=condition" json:"condition,omitempty"` + MatchType MatchType `protobuf:"varint,4,opt,name=match_type,enum=route.MatchType" json:"match_type"` } func (m *TagItem) Reset() { *m = TagItem{} } func (*TagItem) ProtoMessage() {} func (*TagItem) Descriptor() ([]byte, []int) { - return fileDescriptor_0984d49a362b6b9f, []int{0} + return fileDescriptor_0984d49a362b6b9f, []int{2} } func (m *TagItem) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -160,7 +471,7 @@ func (m *TagItem) GetLocation() LocationType { if m != nil { return m.Location } - return LocHttpHeader + return LocUnDefined } func (m *TagItem) GetKey() string { @@ -170,18 +481,18 @@ func (m *TagItem) GetKey() string { return "" } -func (m *TagItem) GetValue() string { +func (m *TagItem) GetCondition() *TagItemCondition { if m != nil { - return m.Value + return m.Condition } - return "" + return nil } func (m *TagItem) GetMatchType() MatchType { if m != nil { return m.MatchType } - return WholeMatch + return MatchUnDefined } type TagRule struct { @@ -191,7 +502,7 @@ type TagRule struct { func (m *TagRule) Reset() { *m = TagRule{} } func (*TagRule) ProtoMessage() {} func (*TagRule) Descriptor() ([]byte, []int) { - return fileDescriptor_0984d49a362b6b9f, []int{1} + return fileDescriptor_0984d49a362b6b9f, []int{3} } func (m *TagRule) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -235,7 +546,7 @@ type TagRouter struct { func (m *TagRouter) Reset() { *m = TagRouter{} } func (*TagRouter) ProtoMessage() {} func (*TagRouter) Descriptor() ([]byte, []int) { - return fileDescriptor_0984d49a362b6b9f, []int{2} + return fileDescriptor_0984d49a362b6b9f, []int{4} } func (m *TagRouter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -278,23 +589,23 @@ func (m *TagRouter) GetRules() []*TagRule { return nil } -type Timeout struct { - ConnectTimeout uint32 `protobuf:"varint,1,opt,name=connect_timeout" json:"connect_timeout"` - ReadTimeout uint32 `protobuf:"varint,2,opt,name=read_timeout" json:"read_timeout"` - WriteTimeout uint32 `protobuf:"varint,3,opt,name=write_timeout" json:"write_timeout"` +type PathRouter struct { + Prefix string `protobuf:"bytes,1,opt,name=prefix" json:"prefix"` + ServiceName string `protobuf:"bytes,2,opt,name=service_name" json:"service_name"` + Tags []*TagRouter `protobuf:"bytes,3,rep,name=tags" json:"tags,omitempty"` } -func (m *Timeout) Reset() { *m = Timeout{} } -func (*Timeout) ProtoMessage() {} -func (*Timeout) Descriptor() ([]byte, []int) { - return fileDescriptor_0984d49a362b6b9f, []int{3} +func (m *PathRouter) Reset() { *m = PathRouter{} } +func (*PathRouter) ProtoMessage() {} +func (*PathRouter) Descriptor() ([]byte, []int) { + return fileDescriptor_0984d49a362b6b9f, []int{5} } -func (m *Timeout) XXX_Unmarshal(b []byte) error { +func (m *PathRouter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *Timeout) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *PathRouter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_Timeout.Marshal(b, m, deterministic) + return xxx_messageInfo_PathRouter.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalTo(b) @@ -304,55 +615,58 @@ func (m *Timeout) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *Timeout) XXX_Merge(src proto.Message) { - xxx_messageInfo_Timeout.Merge(m, src) +func (m *PathRouter) XXX_Merge(src proto.Message) { + xxx_messageInfo_PathRouter.Merge(m, src) } -func (m *Timeout) XXX_Size() int { +func (m *PathRouter) XXX_Size() int { return m.Size() } -func (m *Timeout) XXX_DiscardUnknown() { - xxx_messageInfo_Timeout.DiscardUnknown(m) +func (m *PathRouter) XXX_DiscardUnknown() { + xxx_messageInfo_PathRouter.DiscardUnknown(m) } -var xxx_messageInfo_Timeout proto.InternalMessageInfo +var xxx_messageInfo_PathRouter proto.InternalMessageInfo -func (m *Timeout) GetConnectTimeout() uint32 { +func (m *PathRouter) GetPrefix() string { if m != nil { - return m.ConnectTimeout + return m.Prefix } - return 0 + return "" } -func (m *Timeout) GetReadTimeout() uint32 { +func (m *PathRouter) GetServiceName() string { if m != nil { - return m.ReadTimeout + return m.ServiceName } - return 0 + return "" } -func (m *Timeout) GetWriteTimeout() uint32 { +func (m *PathRouter) GetTags() []*TagRouter { if m != nil { - return m.WriteTimeout + return m.Tags } - return 0 + return nil } -type Upstream struct { - Target string `protobuf:"bytes,1,opt,name=target" json:"target"` - Weight uint32 `protobuf:"varint,2,opt,name=weight" json:"weight"` +type HostRouter struct { + Host string `protobuf:"bytes,1,opt,name=host" json:"host"` + ServiceName string `protobuf:"bytes,2,opt,name=service_name" json:"service_name"` + Paths []*PathRouter `protobuf:"bytes,3,rep,name=paths" json:"paths,omitempty"` + Tags []*TagRouter `protobuf:"bytes,4,rep,name=tags" json:"tags,omitempty"` + Type HostType `protobuf:"varint,5,opt,name=type,enum=route.HostType" json:"type"` } -func (m *Upstream) Reset() { *m = Upstream{} } -func (*Upstream) ProtoMessage() {} -func (*Upstream) Descriptor() ([]byte, []int) { - return fileDescriptor_0984d49a362b6b9f, []int{4} +func (m *HostRouter) Reset() { *m = HostRouter{} } +func (*HostRouter) ProtoMessage() {} +func (*HostRouter) Descriptor() ([]byte, []int) { + return fileDescriptor_0984d49a362b6b9f, []int{6} } -func (m *Upstream) XXX_Unmarshal(b []byte) error { +func (m *HostRouter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *Upstream) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *HostRouter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_Upstream.Marshal(b, m, deterministic) + return xxx_messageInfo_HostRouter.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalTo(b) @@ -362,175 +676,70 @@ func (m *Upstream) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *Upstream) XXX_Merge(src proto.Message) { - xxx_messageInfo_Upstream.Merge(m, src) +func (m *HostRouter) XXX_Merge(src proto.Message) { + xxx_messageInfo_HostRouter.Merge(m, src) } -func (m *Upstream) XXX_Size() int { +func (m *HostRouter) XXX_Size() int { return m.Size() } -func (m *Upstream) XXX_DiscardUnknown() { - xxx_messageInfo_Upstream.DiscardUnknown(m) -} - -var xxx_messageInfo_Upstream proto.InternalMessageInfo - -func (m *Upstream) GetTarget() string { - if m != nil { - return m.Target - } - return "" -} - -func (m *Upstream) GetWeight() uint32 { - if m != nil { - return m.Weight - } - return 0 -} - -type Metadata struct { - Key string `protobuf:"bytes,1,opt,name=key" json:"key"` - Value string `protobuf:"bytes,2,opt,name=value" json:"value"` -} - -func (m *Metadata) Reset() { *m = Metadata{} } -func (*Metadata) ProtoMessage() {} -func (*Metadata) Descriptor() ([]byte, []int) { - return fileDescriptor_0984d49a362b6b9f, []int{5} -} -func (m *Metadata) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Metadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Metadata.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Metadata) XXX_Merge(src proto.Message) { - xxx_messageInfo_Metadata.Merge(m, src) -} -func (m *Metadata) XXX_Size() int { - return m.Size() -} -func (m *Metadata) XXX_DiscardUnknown() { - xxx_messageInfo_Metadata.DiscardUnknown(m) +func (m *HostRouter) XXX_DiscardUnknown() { + xxx_messageInfo_HostRouter.DiscardUnknown(m) } -var xxx_messageInfo_Metadata proto.InternalMessageInfo - -func (m *Metadata) GetKey() string { - if m != nil { - return m.Key - } - return "" -} +var xxx_messageInfo_HostRouter proto.InternalMessageInfo -func (m *Metadata) GetValue() string { +func (m *HostRouter) GetHost() string { if m != nil { - return m.Value + return m.Host } return "" } -type VirtualService struct { - ServiceName string `protobuf:"bytes,1,req,name=service_name" json:"service_name"` - Upstreams []*Upstream `protobuf:"bytes,2,rep,name=upstreams" json:"upstreams,omitempty"` - TimeoutMs *Timeout `protobuf:"bytes,3,opt,name=timeout_ms" json:"timeout_ms,omitempty"` - ForceHttps bool `protobuf:"varint,4,opt,name=force_https" json:"force_https"` - Metadata []*Metadata `protobuf:"bytes,5,rep,name=metadata" json:"metadata,omitempty"` -} - -func (m *VirtualService) Reset() { *m = VirtualService{} } -func (*VirtualService) ProtoMessage() {} -func (*VirtualService) Descriptor() ([]byte, []int) { - return fileDescriptor_0984d49a362b6b9f, []int{6} -} -func (m *VirtualService) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VirtualService) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_VirtualService.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *VirtualService) XXX_Merge(src proto.Message) { - xxx_messageInfo_VirtualService.Merge(m, src) -} -func (m *VirtualService) XXX_Size() int { - return m.Size() -} -func (m *VirtualService) XXX_DiscardUnknown() { - xxx_messageInfo_VirtualService.DiscardUnknown(m) -} - -var xxx_messageInfo_VirtualService proto.InternalMessageInfo - -func (m *VirtualService) GetServiceName() string { +func (m *HostRouter) GetServiceName() string { if m != nil { return m.ServiceName } return "" } -func (m *VirtualService) GetUpstreams() []*Upstream { +func (m *HostRouter) GetPaths() []*PathRouter { if m != nil { - return m.Upstreams + return m.Paths } return nil } -func (m *VirtualService) GetTimeoutMs() *Timeout { +func (m *HostRouter) GetTags() []*TagRouter { if m != nil { - return m.TimeoutMs + return m.Tags } return nil } -func (m *VirtualService) GetForceHttps() bool { - if m != nil { - return m.ForceHttps - } - return false -} - -func (m *VirtualService) GetMetadata() []*Metadata { +func (m *HostRouter) GetType() HostType { if m != nil { - return m.Metadata + return m.Type } - return nil + return Web } -type PathRouter struct { - Path string `protobuf:"bytes,1,opt,name=path" json:"path"` +type AppnameRouter struct { + Appname string `protobuf:"bytes,1,opt,name=appname" json:"appname"` ServiceName string `protobuf:"bytes,2,opt,name=service_name" json:"service_name"` Tags []*TagRouter `protobuf:"bytes,3,rep,name=tags" json:"tags,omitempty"` } -func (m *PathRouter) Reset() { *m = PathRouter{} } -func (*PathRouter) ProtoMessage() {} -func (*PathRouter) Descriptor() ([]byte, []int) { +func (m *AppnameRouter) Reset() { *m = AppnameRouter{} } +func (*AppnameRouter) ProtoMessage() {} +func (*AppnameRouter) Descriptor() ([]byte, []int) { return fileDescriptor_0984d49a362b6b9f, []int{7} } -func (m *PathRouter) XXX_Unmarshal(b []byte) error { +func (m *AppnameRouter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *PathRouter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *AppnameRouter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_PathRouter.Marshal(b, m, deterministic) + return xxx_messageInfo_AppnameRouter.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalTo(b) @@ -540,57 +749,56 @@ func (m *PathRouter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *PathRouter) XXX_Merge(src proto.Message) { - xxx_messageInfo_PathRouter.Merge(m, src) +func (m *AppnameRouter) XXX_Merge(src proto.Message) { + xxx_messageInfo_AppnameRouter.Merge(m, src) } -func (m *PathRouter) XXX_Size() int { +func (m *AppnameRouter) XXX_Size() int { return m.Size() } -func (m *PathRouter) XXX_DiscardUnknown() { - xxx_messageInfo_PathRouter.DiscardUnknown(m) +func (m *AppnameRouter) XXX_DiscardUnknown() { + xxx_messageInfo_AppnameRouter.DiscardUnknown(m) } -var xxx_messageInfo_PathRouter proto.InternalMessageInfo +var xxx_messageInfo_AppnameRouter proto.InternalMessageInfo -func (m *PathRouter) GetPath() string { +func (m *AppnameRouter) GetAppname() string { if m != nil { - return m.Path + return m.Appname } return "" } -func (m *PathRouter) GetServiceName() string { +func (m *AppnameRouter) GetServiceName() string { if m != nil { return m.ServiceName } return "" } -func (m *PathRouter) GetTags() []*TagRouter { +func (m *AppnameRouter) GetTags() []*TagRouter { if m != nil { return m.Tags } return nil } -type HostRouter struct { - Host string `protobuf:"bytes,1,opt,name=host" json:"host"` - ServiceName string `protobuf:"bytes,2,opt,name=service_name" json:"service_name"` - Paths []*PathRouter `protobuf:"bytes,3,rep,name=paths" json:"paths,omitempty"` - Tags []*TagRouter `protobuf:"bytes,4,rep,name=tags" json:"tags,omitempty"` +type APIRouter struct { + ServiceName string `protobuf:"bytes,1,opt,name=service_name" json:"service_name"` + Api string `protobuf:"bytes,2,opt,name=api" json:"api"` + Tags []*TagRouter `protobuf:"bytes,3,rep,name=tags" json:"tags,omitempty"` } -func (m *HostRouter) Reset() { *m = HostRouter{} } -func (*HostRouter) ProtoMessage() {} -func (*HostRouter) Descriptor() ([]byte, []int) { +func (m *APIRouter) Reset() { *m = APIRouter{} } +func (*APIRouter) ProtoMessage() {} +func (*APIRouter) Descriptor() ([]byte, []int) { return fileDescriptor_0984d49a362b6b9f, []int{8} } -func (m *HostRouter) XXX_Unmarshal(b []byte) error { +func (m *APIRouter) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *HostRouter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *APIRouter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_HostRouter.Marshal(b, m, deterministic) + return xxx_messageInfo_APIRouter.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalTo(b) @@ -600,40 +808,33 @@ func (m *HostRouter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *HostRouter) XXX_Merge(src proto.Message) { - xxx_messageInfo_HostRouter.Merge(m, src) +func (m *APIRouter) XXX_Merge(src proto.Message) { + xxx_messageInfo_APIRouter.Merge(m, src) } -func (m *HostRouter) XXX_Size() int { +func (m *APIRouter) XXX_Size() int { return m.Size() } -func (m *HostRouter) XXX_DiscardUnknown() { - xxx_messageInfo_HostRouter.DiscardUnknown(m) +func (m *APIRouter) XXX_DiscardUnknown() { + xxx_messageInfo_APIRouter.DiscardUnknown(m) } -var xxx_messageInfo_HostRouter proto.InternalMessageInfo - -func (m *HostRouter) GetHost() string { - if m != nil { - return m.Host - } - return "" -} +var xxx_messageInfo_APIRouter proto.InternalMessageInfo -func (m *HostRouter) GetServiceName() string { +func (m *APIRouter) GetServiceName() string { if m != nil { return m.ServiceName } return "" } -func (m *HostRouter) GetPaths() []*PathRouter { +func (m *APIRouter) GetApi() string { if m != nil { - return m.Paths + return m.Api } - return nil + return "" } -func (m *HostRouter) GetTags() []*TagRouter { +func (m *APIRouter) GetTags() []*TagRouter { if m != nil { return m.Tags } @@ -641,7 +842,9 @@ func (m *HostRouter) GetTags() []*TagRouter { } type Router struct { - HostRouter *HostRouter `protobuf:"bytes,1,opt,name=host_router" json:"host_router,omitempty"` + HostRouter *HostRouter `protobuf:"bytes,1,opt,name=host_router" json:"host_router,omitempty"` + AppnameRouter *AppnameRouter `protobuf:"bytes,2,opt,name=appname_router" json:"appname_router,omitempty"` + ApiRouter *APIRouter `protobuf:"bytes,3,opt,name=api_router" json:"api_router,omitempty"` } func (m *Router) Reset() { *m = Router{} } @@ -683,22 +886,36 @@ func (m *Router) GetHostRouter() *HostRouter { return nil } -type Config struct { - Routers []*Router `protobuf:"bytes,1,rep,name=routers" json:"routers,omitempty"` - Services []*VirtualService `protobuf:"bytes,2,rep,name=services" json:"services,omitempty"` +func (m *Router) GetAppnameRouter() *AppnameRouter { + if m != nil { + return m.AppnameRouter + } + return nil } -func (m *Config) Reset() { *m = Config{} } -func (*Config) ProtoMessage() {} -func (*Config) Descriptor() ([]byte, []int) { +func (m *Router) GetApiRouter() *APIRouter { + if m != nil { + return m.ApiRouter + } + return nil +} + +type Upstream struct { + Target string `protobuf:"bytes,1,opt,name=target" json:"target"` + Weight uint32 `protobuf:"varint,2,opt,name=weight" json:"weight"` +} + +func (m *Upstream) Reset() { *m = Upstream{} } +func (*Upstream) ProtoMessage() {} +func (*Upstream) Descriptor() ([]byte, []int) { return fileDescriptor_0984d49a362b6b9f, []int{10} } -func (m *Config) XXX_Unmarshal(b []byte) error { +func (m *Upstream) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *Config) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *Upstream) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_Config.Marshal(b, m, deterministic) + return xxx_messageInfo_Upstream.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalTo(b) @@ -708,296 +925,493 @@ func (m *Config) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *Config) XXX_Merge(src proto.Message) { - xxx_messageInfo_Config.Merge(m, src) +func (m *Upstream) XXX_Merge(src proto.Message) { + xxx_messageInfo_Upstream.Merge(m, src) } -func (m *Config) XXX_Size() int { +func (m *Upstream) XXX_Size() int { return m.Size() } -func (m *Config) XXX_DiscardUnknown() { - xxx_messageInfo_Config.DiscardUnknown(m) +func (m *Upstream) XXX_DiscardUnknown() { + xxx_messageInfo_Upstream.DiscardUnknown(m) } -var xxx_messageInfo_Config proto.InternalMessageInfo +var xxx_messageInfo_Upstream proto.InternalMessageInfo -func (m *Config) GetRouters() []*Router { +func (m *Upstream) GetTarget() string { if m != nil { - return m.Routers + return m.Target } - return nil + return "" } -func (m *Config) GetServices() []*VirtualService { +func (m *Upstream) GetWeight() uint32 { if m != nil { - return m.Services + return m.Weight } - return nil -} - -func init() { - proto.RegisterEnum("route.LocationType", LocationType_name, LocationType_value) - proto.RegisterEnum("route.MatchType", MatchType_name, MatchType_value) - proto.RegisterType((*TagItem)(nil), "route.TagItem") - proto.RegisterType((*TagRule)(nil), "route.TagRule") - proto.RegisterType((*TagRouter)(nil), "route.TagRouter") - proto.RegisterType((*Timeout)(nil), "route.Timeout") - proto.RegisterType((*Upstream)(nil), "route.Upstream") - proto.RegisterType((*Metadata)(nil), "route.Metadata") - proto.RegisterType((*VirtualService)(nil), "route.VirtualService") - proto.RegisterType((*PathRouter)(nil), "route.PathRouter") - proto.RegisterType((*HostRouter)(nil), "route.HostRouter") - proto.RegisterType((*Router)(nil), "route.Router") - proto.RegisterType((*Config)(nil), "route.Config") + return 0 } -func init() { proto.RegisterFile("route.proto", fileDescriptor_0984d49a362b6b9f) } - -var fileDescriptor_0984d49a362b6b9f = []byte{ - // 663 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xbd, 0x6e, 0xd4, 0x4a, - 0x14, 0xc7, 0x3d, 0xfb, 0x15, 0xef, 0xd9, 0x8f, 0x38, 0x93, 0x5c, 0x69, 0x6f, 0xae, 0x32, 0x77, - 0xaf, 0x8b, 0xcb, 0x2a, 0x48, 0x01, 0xa5, 0xa0, 0x41, 0xa2, 0x08, 0x12, 0x4a, 0x44, 0x82, 0xf2, - 0x0d, 0x42, 0x48, 0xab, 0x91, 0x33, 0x6b, 0x5b, 0xac, 0x3d, 0xd6, 0x78, 0x9c, 0x64, 0x29, 0x10, - 0x35, 0x15, 0x8f, 0x41, 0xcd, 0x53, 0xa4, 0x4c, 0x99, 0x0a, 0x11, 0xa7, 0xa1, 0xcc, 0x23, 0x20, - 0xcf, 0x8e, 0x77, 0xbd, 0x51, 0x90, 0x28, 0xe7, 0x7f, 0xce, 0xfc, 0xce, 0xff, 0x9c, 0x33, 0x03, - 0x0d, 0xc1, 0x13, 0xc9, 0xd6, 0x22, 0xc1, 0x25, 0xc7, 0x55, 0x75, 0xb0, 0x3f, 0x23, 0x98, 0x3b, - 0xa4, 0xee, 0x96, 0x64, 0x01, 0x7e, 0x08, 0xe6, 0x90, 0x3b, 0x54, 0xfa, 0x3c, 0xec, 0xa0, 0x2e, - 0xea, 0xb5, 0xd7, 0x17, 0xd7, 0xc6, 0x57, 0xb6, 0xb5, 0x7c, 0x38, 0x8a, 0xd8, 0x46, 0xe5, 0xe2, - 0xfb, 0xbf, 0x06, 0x5e, 0x80, 0xf2, 0x7b, 0x36, 0xea, 0x94, 0xba, 0xa8, 0x57, 0xd7, 0xd2, 0x22, - 0x54, 0x4f, 0xe9, 0x30, 0x61, 0x9d, 0x72, 0x41, 0x5c, 0x05, 0x08, 0xa8, 0x74, 0xbc, 0xbe, 0x1c, - 0x45, 0xac, 0x53, 0x51, 0x58, 0x4b, 0x63, 0x77, 0xb2, 0xc0, 0x94, 0x69, 0xf7, 0x94, 0x97, 0xfd, - 0x64, 0xc8, 0xf0, 0x0a, 0x54, 0x7d, 0xc9, 0x82, 0xb8, 0x83, 0xba, 0xe5, 0x5e, 0x63, 0xbd, 0xad, - 0x6f, 0x68, 0xab, 0xf6, 0x0b, 0xa8, 0x67, 0x99, 0x99, 0x26, 0xf0, 0x32, 0x34, 0x63, 0x26, 0x4e, - 0x7d, 0x87, 0xf5, 0x43, 0x1a, 0x30, 0xe5, 0x3d, 0x2f, 0xbf, 0x02, 0x55, 0x91, 0x0c, 0x59, 0xdc, - 0x29, 0xdd, 0xe5, 0x64, 0x65, 0x6c, 0x0a, 0x73, 0x87, 0x7e, 0xc0, 0x78, 0x22, 0xf1, 0x0a, 0xcc, - 0x3b, 0x3c, 0x0c, 0x99, 0x23, 0xfb, 0x72, 0x2c, 0x29, 0x50, 0x4b, 0x83, 0x96, 0xa1, 0x29, 0x18, - 0x3d, 0x99, 0xc4, 0x4a, 0x85, 0xd8, 0x3f, 0xd0, 0x3a, 0x13, 0xbe, 0x64, 0x93, 0x60, 0x79, 0x1a, - 0xb4, 0x9f, 0x80, 0x79, 0x14, 0xc5, 0x52, 0x30, 0x1a, 0xe0, 0x25, 0xa8, 0x49, 0x2a, 0x5c, 0x26, - 0x67, 0x3c, 0x2e, 0x41, 0xed, 0x8c, 0xf9, 0xae, 0x37, 0x03, 0xb5, 0xd7, 0xc1, 0xdc, 0x61, 0x92, - 0x9e, 0x50, 0x49, 0xf3, 0x61, 0xa3, 0xfb, 0x86, 0x5d, 0xd8, 0x80, 0xfd, 0x0d, 0x41, 0xfb, 0xd8, - 0x17, 0x32, 0xa1, 0xc3, 0x83, 0xf1, 0x44, 0xee, 0x19, 0x4e, 0x69, 0xc2, 0xb0, 0xa1, 0x9e, 0x68, - 0x6b, 0xf9, 0x80, 0xe6, 0xf5, 0x80, 0x26, 0x96, 0x6d, 0x00, 0xdd, 0x55, 0x3f, 0x88, 0x55, 0x63, - 0x85, 0x29, 0xea, 0xd1, 0xfd, 0x0d, 0x8d, 0x01, 0x17, 0x0e, 0xeb, 0x7b, 0x52, 0x46, 0xb1, 0x5a, - 0xb2, 0xa9, 0x4b, 0xfc, 0x07, 0x66, 0xa0, 0xbb, 0xe8, 0x54, 0x67, 0x2a, 0xe4, 0xcd, 0xd9, 0xef, - 0x00, 0x76, 0xa9, 0xf4, 0xf4, 0x32, 0x31, 0x54, 0x22, 0x2a, 0xbd, 0x99, 0x5e, 0xef, 0xf6, 0x50, - 0x7c, 0x74, 0x04, 0x2a, 0x92, 0xba, 0x99, 0xb3, 0x0c, 0x6e, 0x15, 0xf6, 0xab, 0x78, 0xf6, 0x47, - 0x80, 0x4d, 0x1e, 0xcb, 0x29, 0xdd, 0xe3, 0xb1, 0xfc, 0x63, 0x7a, 0x17, 0xaa, 0x99, 0x9b, 0x1c, - 0xbf, 0xa0, 0xf1, 0x05, 0xbf, 0x79, 0xfd, 0xca, 0x6f, 0xea, 0x3f, 0x86, 0x9a, 0xce, 0xfc, 0x1f, - 0x1a, 0x59, 0xed, 0xbe, 0xca, 0x10, 0xca, 0xc2, 0x94, 0x38, 0xf5, 0x68, 0xef, 0x41, 0xed, 0x39, - 0x0f, 0x07, 0xbe, 0x8b, 0x09, 0xcc, 0x8d, 0x93, 0xf3, 0x6f, 0xd0, 0xd2, 0xd9, 0x9a, 0xf8, 0x00, - 0x4c, 0xed, 0x3c, 0x5f, 0xdf, 0x5f, 0x3a, 0x61, 0xf6, 0x11, 0xac, 0x1e, 0x41, 0xb3, 0xf8, 0x85, - 0xf1, 0x02, 0xb4, 0xb6, 0xb9, 0xb3, 0x29, 0x65, 0xb4, 0xc9, 0xe8, 0x09, 0x13, 0x96, 0x81, 0x2d, - 0x95, 0x92, 0x49, 0x7b, 0x09, 0x13, 0x23, 0x0b, 0xe1, 0x79, 0x68, 0x6c, 0x73, 0xe7, 0x95, 0xeb, - 0x87, 0xe7, 0xc7, 0x54, 0x58, 0x25, 0x2d, 0xbc, 0xd9, 0xf0, 0x3f, 0x6c, 0x85, 0x03, 0x6e, 0x95, - 0x57, 0x5f, 0x42, 0x7d, 0xf2, 0x85, 0x71, 0x1b, 0xe0, 0xb5, 0xc7, 0x87, 0x4c, 0x29, 0x96, 0x91, - 0x65, 0xef, 0x0a, 0x36, 0xf0, 0xcf, 0xc7, 0x82, 0xe2, 0x1d, 0x24, 0x83, 0x89, 0x50, 0xc2, 0x4d, - 0x30, 0xf7, 0x99, 0x3b, 0x3e, 0x95, 0x37, 0x9e, 0x5d, 0x5e, 0x13, 0xe3, 0xea, 0x9a, 0x18, 0xb7, - 0xd7, 0x04, 0x7d, 0x4a, 0x09, 0xfa, 0x9a, 0x12, 0x74, 0x91, 0x12, 0x74, 0x99, 0x12, 0xf4, 0x23, - 0x25, 0xe8, 0x67, 0x4a, 0x8c, 0xdb, 0x94, 0xa0, 0x2f, 0x37, 0xc4, 0xb8, 0xbc, 0x21, 0xc6, 0xd5, - 0x0d, 0x31, 0xde, 0x9a, 0x6b, 0x8f, 0x9e, 0xaa, 0x96, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0x76, - 0x98, 0x1f, 0xfe, 0xde, 0x04, 0x00, 0x00, +type Timeout struct { + ConnectTimeout uint32 `protobuf:"varint,1,opt,name=connect_timeout" json:"connect_timeout"` + ReadTimeout uint32 `protobuf:"varint,2,opt,name=read_timeout" json:"read_timeout"` + WriteTimeout uint32 `protobuf:"varint,3,opt,name=write_timeout" json:"write_timeout"` } -func (x LocationType) String() string { - s, ok := LocationType_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) +func (m *Timeout) Reset() { *m = Timeout{} } +func (*Timeout) ProtoMessage() {} +func (*Timeout) Descriptor() ([]byte, []int) { + return fileDescriptor_0984d49a362b6b9f, []int{11} } -func (x MatchType) String() string { - s, ok := MatchType_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) +func (m *Timeout) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) } -func (this *TagItem) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*TagItem) - if !ok { - that2, ok := that.(TagItem) - if ok { - that1 = &that2 - } else { - return false +func (m *Timeout) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Timeout.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Location != that1.Location { - return false - } - if this.Key != that1.Key { - return false - } - if this.Value != that1.Value { - return false - } - if this.MatchType != that1.MatchType { - return false - } - return true } -func (this *TagRule) Equal(that interface{}) bool { - if that == nil { - return this == nil - } +func (m *Timeout) XXX_Merge(src proto.Message) { + xxx_messageInfo_Timeout.Merge(m, src) +} +func (m *Timeout) XXX_Size() int { + return m.Size() +} +func (m *Timeout) XXX_DiscardUnknown() { + xxx_messageInfo_Timeout.DiscardUnknown(m) +} - that1, ok := that.(*TagRule) - if !ok { - that2, ok := that.(TagRule) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.Items) != len(that1.Items) { - return false - } - for i := range this.Items { - if !this.Items[i].Equal(that1.Items[i]) { - return false - } +var xxx_messageInfo_Timeout proto.InternalMessageInfo + +func (m *Timeout) GetConnectTimeout() uint32 { + if m != nil { + return m.ConnectTimeout } - return true + return 0 } -func (this *TagRouter) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - that1, ok := that.(*TagRouter) - if !ok { - that2, ok := that.(TagRouter) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.ServiceName != that1.ServiceName { - return false - } - if len(this.Rules) != len(that1.Rules) { - return false - } - for i := range this.Rules { - if !this.Rules[i].Equal(that1.Rules[i]) { - return false - } +func (m *Timeout) GetReadTimeout() uint32 { + if m != nil { + return m.ReadTimeout } - return true + return 0 } -func (this *Timeout) Equal(that interface{}) bool { - if that == nil { - return this == nil + +func (m *Timeout) GetWriteTimeout() uint32 { + if m != nil { + return m.WriteTimeout } + return 0 +} - that1, ok := that.(*Timeout) - if !ok { - that2, ok := that.(Timeout) - if ok { - that1 = &that2 - } else { - return false +type Metadata struct { + Key string `protobuf:"bytes,1,opt,name=key" json:"key"` + Value string `protobuf:"bytes,2,opt,name=value" json:"value"` +} + +func (m *Metadata) Reset() { *m = Metadata{} } +func (*Metadata) ProtoMessage() {} +func (*Metadata) Descriptor() ([]byte, []int) { + return fileDescriptor_0984d49a362b6b9f, []int{12} +} +func (m *Metadata) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Metadata) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Metadata.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.ConnectTimeout != that1.ConnectTimeout { - return false - } - if this.ReadTimeout != that1.ReadTimeout { - return false - } - if this.WriteTimeout != that1.WriteTimeout { - return false +} +func (m *Metadata) XXX_Merge(src proto.Message) { + xxx_messageInfo_Metadata.Merge(m, src) +} +func (m *Metadata) XXX_Size() int { + return m.Size() +} +func (m *Metadata) XXX_DiscardUnknown() { + xxx_messageInfo_Metadata.DiscardUnknown(m) +} + +var xxx_messageInfo_Metadata proto.InternalMessageInfo + +func (m *Metadata) GetKey() string { + if m != nil { + return m.Key } - return true + return "" } -func (this *Upstream) Equal(that interface{}) bool { - if that == nil { - return this == nil + +func (m *Metadata) GetValue() string { + if m != nil { + return m.Value } + return "" +} - that1, ok := that.(*Upstream) - if !ok { - that2, ok := that.(Upstream) - if ok { - that1 = &that2 - } else { - return false +type Action struct { + ActionType ActionType `protobuf:"varint,1,opt,name=action_type,enum=route.ActionType" json:"action_type"` + ValueType ActionValueType `protobuf:"varint,2,opt,name=value_type,enum=route.ActionValueType" json:"value_type"` + Key string `protobuf:"bytes,3,opt,name=key" json:"key"` + Value string `protobuf:"bytes,4,opt,name=value" json:"value"` +} + +func (m *Action) Reset() { *m = Action{} } +func (*Action) ProtoMessage() {} +func (*Action) Descriptor() ([]byte, []int) { + return fileDescriptor_0984d49a362b6b9f, []int{13} +} +func (m *Action) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Action) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Action.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err } + return b[:n], nil } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Target != that1.Target { - return false +} +func (m *Action) XXX_Merge(src proto.Message) { + xxx_messageInfo_Action.Merge(m, src) +} +func (m *Action) XXX_Size() int { + return m.Size() +} +func (m *Action) XXX_DiscardUnknown() { + xxx_messageInfo_Action.DiscardUnknown(m) +} + +var xxx_messageInfo_Action proto.InternalMessageInfo + +func (m *Action) GetActionType() ActionType { + if m != nil { + return m.ActionType } - if this.Weight != that1.Weight { - return false + return ActionUnDefined +} + +func (m *Action) GetValueType() ActionValueType { + if m != nil { + return m.ValueType } - return true + return ActionValueUnDefined } -func (this *Metadata) Equal(that interface{}) bool { - if that == nil { - return this == nil + +func (m *Action) GetKey() string { + if m != nil { + return m.Key } + return "" +} - that1, ok := that.(*Metadata) - if !ok { - that2, ok := that.(Metadata) - if ok { - that1 = &that2 - } else { - return false - } +func (m *Action) GetValue() string { + if m != nil { + return m.Value } - if that1 == nil { - return this == nil - } else if this == nil { - return false + return "" +} + +type VirtualService struct { + ServiceName string `protobuf:"bytes,1,req,name=service_name" json:"service_name"` + Upstreams []*Upstream `protobuf:"bytes,2,rep,name=upstreams" json:"upstreams,omitempty"` + TimeoutMs *Timeout `protobuf:"bytes,3,opt,name=timeout_ms" json:"timeout_ms,omitempty"` + ForceHttps bool `protobuf:"varint,4,opt,name=force_https" json:"force_https"` + Metadata []*Metadata `protobuf:"bytes,5,rep,name=metadata" json:"metadata,omitempty"` + Action []*Action `protobuf:"bytes,6,rep,name=action" json:"action,omitempty"` +} + +func (m *VirtualService) Reset() { *m = VirtualService{} } +func (*VirtualService) ProtoMessage() {} +func (*VirtualService) Descriptor() ([]byte, []int) { + return fileDescriptor_0984d49a362b6b9f, []int{14} +} +func (m *VirtualService) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VirtualService) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VirtualService.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil } - if this.Key != that1.Key { - return false +} +func (m *VirtualService) XXX_Merge(src proto.Message) { + xxx_messageInfo_VirtualService.Merge(m, src) +} +func (m *VirtualService) XXX_Size() int { + return m.Size() +} +func (m *VirtualService) XXX_DiscardUnknown() { + xxx_messageInfo_VirtualService.DiscardUnknown(m) +} + +var xxx_messageInfo_VirtualService proto.InternalMessageInfo + +func (m *VirtualService) GetServiceName() string { + if m != nil { + return m.ServiceName } - if this.Value != that1.Value { - return false + return "" +} + +func (m *VirtualService) GetUpstreams() []*Upstream { + if m != nil { + return m.Upstreams } - return true + return nil } -func (this *VirtualService) Equal(that interface{}) bool { + +func (m *VirtualService) GetTimeoutMs() *Timeout { + if m != nil { + return m.TimeoutMs + } + return nil +} + +func (m *VirtualService) GetForceHttps() bool { + if m != nil { + return m.ForceHttps + } + return false +} + +func (m *VirtualService) GetMetadata() []*Metadata { + if m != nil { + return m.Metadata + } + return nil +} + +func (m *VirtualService) GetAction() []*Action { + if m != nil { + return m.Action + } + return nil +} + +type Config struct { + Routers []*Router `protobuf:"bytes,1,rep,name=routers" json:"routers,omitempty"` + Services []*VirtualService `protobuf:"bytes,2,rep,name=services" json:"services,omitempty"` +} + +func (m *Config) Reset() { *m = Config{} } +func (*Config) ProtoMessage() {} +func (*Config) Descriptor() ([]byte, []int) { + return fileDescriptor_0984d49a362b6b9f, []int{15} +} +func (m *Config) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Config) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Config.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalTo(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Config) XXX_Merge(src proto.Message) { + xxx_messageInfo_Config.Merge(m, src) +} +func (m *Config) XXX_Size() int { + return m.Size() +} +func (m *Config) XXX_DiscardUnknown() { + xxx_messageInfo_Config.DiscardUnknown(m) +} + +var xxx_messageInfo_Config proto.InternalMessageInfo + +func (m *Config) GetRouters() []*Router { + if m != nil { + return m.Routers + } + return nil +} + +func (m *Config) GetServices() []*VirtualService { + if m != nil { + return m.Services + } + return nil +} + +func init() { + proto.RegisterEnum("route.OperatorType", OperatorType_name, OperatorType_value) + proto.RegisterEnum("route.LocationType", LocationType_name, LocationType_value) + proto.RegisterEnum("route.MatchType", MatchType_name, MatchType_value) + proto.RegisterEnum("route.HostType", HostType_name, HostType_value) + proto.RegisterEnum("route.ActionType", ActionType_name, ActionType_value) + proto.RegisterEnum("route.ActionValueType", ActionValueType_name, ActionValueType_value) + proto.RegisterType((*TagValueStrList)(nil), "route.TagValueStrList") + proto.RegisterType((*TagItemCondition)(nil), "route.TagItemCondition") + proto.RegisterType((*TagItem)(nil), "route.TagItem") + proto.RegisterType((*TagRule)(nil), "route.TagRule") + proto.RegisterType((*TagRouter)(nil), "route.TagRouter") + proto.RegisterType((*PathRouter)(nil), "route.PathRouter") + proto.RegisterType((*HostRouter)(nil), "route.HostRouter") + proto.RegisterType((*AppnameRouter)(nil), "route.AppnameRouter") + proto.RegisterType((*APIRouter)(nil), "route.APIRouter") + proto.RegisterType((*Router)(nil), "route.Router") + proto.RegisterType((*Upstream)(nil), "route.Upstream") + proto.RegisterType((*Timeout)(nil), "route.Timeout") + proto.RegisterType((*Metadata)(nil), "route.Metadata") + proto.RegisterType((*Action)(nil), "route.Action") + proto.RegisterType((*VirtualService)(nil), "route.VirtualService") + proto.RegisterType((*Config)(nil), "route.Config") +} + +func init() { proto.RegisterFile("route.proto", fileDescriptor_0984d49a362b6b9f) } + +var fileDescriptor_0984d49a362b6b9f = []byte{ + // 1103 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xf7, 0x78, 0xd7, 0xff, 0x9e, 0x6b, 0x67, 0x33, 0x89, 0x13, 0xb7, 0x28, 0x8b, 0x31, 0x08, + 0x2c, 0x53, 0x15, 0xe4, 0x03, 0x17, 0x24, 0xa4, 0x24, 0x05, 0x12, 0xc9, 0xa1, 0x69, 0x93, 0xa6, + 0x28, 0x07, 0xac, 0xe9, 0x7a, 0x62, 0xaf, 0xea, 0xdd, 0xd9, 0xce, 0x8e, 0xd3, 0xa6, 0x27, 0x0e, + 0x7c, 0x80, 0x7c, 0x01, 0x0e, 0x88, 0x0b, 0x1f, 0x80, 0x0f, 0xd1, 0x63, 0xb8, 0xf5, 0x84, 0x88, + 0x73, 0xe1, 0xd8, 0x8f, 0x80, 0x76, 0x76, 0x66, 0x3d, 0x0e, 0x39, 0x14, 0x89, 0xdb, 0xce, 0x7b, + 0xbf, 0xf9, 0xbd, 0xdf, 0xfc, 0xde, 0xcc, 0x5b, 0xa8, 0x72, 0x36, 0x15, 0xf4, 0x5e, 0xc4, 0x99, + 0x60, 0xb8, 0x20, 0x17, 0xed, 0x16, 0x2c, 0x1d, 0x92, 0xd1, 0x11, 0x99, 0x4c, 0xe9, 0x81, 0xe0, + 0x7d, 0x3f, 0x16, 0xb8, 0x06, 0x85, 0xd3, 0x64, 0xdd, 0x44, 0x2d, 0xab, 0x53, 0x69, 0xff, 0x8e, + 0xc0, 0x39, 0x24, 0xa3, 0x5d, 0x41, 0x83, 0x6d, 0x16, 0x0e, 0x7d, 0xe1, 0xb3, 0x10, 0xaf, 0x43, + 0x45, 0x62, 0x06, 0xb1, 0xe0, 0x4d, 0xd4, 0x42, 0x9d, 0xca, 0x96, 0xfd, 0xfa, 0xcf, 0xf7, 0x73, + 0xb8, 0x0b, 0x90, 0x26, 0x26, 0x7e, 0x2c, 0x9a, 0xf9, 0x16, 0xea, 0x54, 0x7b, 0x6b, 0xf7, 0xd2, + 0xc2, 0xd7, 0x0b, 0x35, 0xa0, 0x34, 0xf4, 0x4f, 0xfd, 0x98, 0xf1, 0xa6, 0xd5, 0x42, 0x1d, 0x5b, + 0x51, 0xac, 0x43, 0x85, 0xd3, 0x80, 0xf8, 0xe1, 0x90, 0xf2, 0xa6, 0x6d, 0x24, 0x3e, 0x85, 0x32, + 0x8b, 0x28, 0x27, 0x82, 0xf1, 0x66, 0xa1, 0x85, 0x3a, 0xf5, 0xde, 0x8a, 0x62, 0x7e, 0xa0, 0xc2, + 0x87, 0x67, 0x11, 0x4d, 0xc1, 0xed, 0x5f, 0x10, 0x94, 0x94, 0xec, 0x64, 0xe3, 0x84, 0x79, 0x24, + 0x51, 0x2e, 0xc5, 0xce, 0x37, 0xf6, 0x55, 0x78, 0xbe, 0x11, 0x2f, 0x83, 0xf5, 0x8c, 0x9e, 0x49, + 0xe9, 0xf3, 0x43, 0x55, 0x3c, 0x7d, 0x74, 0x29, 0xb5, 0xda, 0x5b, 0x9f, 0x9f, 0x69, 0xd1, 0x99, + 0x2e, 0x40, 0x40, 0x84, 0x37, 0x1e, 0x88, 0xb3, 0x88, 0x4a, 0xf9, 0xf5, 0x9e, 0xa3, 0xc0, 0x7b, + 0x49, 0xc2, 0xd0, 0xd8, 0x91, 0x12, 0x1f, 0x4d, 0x27, 0x14, 0x6f, 0x40, 0xc1, 0x17, 0x34, 0x88, + 0xa5, 0xe9, 0xd5, 0x5e, 0x7d, 0x91, 0xbe, 0xfd, 0x0d, 0x54, 0x12, 0x64, 0x12, 0xe3, 0xf8, 0x0e, + 0xdc, 0x8a, 0x29, 0x3f, 0xf5, 0x3d, 0x3a, 0x08, 0x49, 0x40, 0x17, 0xfc, 0xdf, 0x80, 0x02, 0x9f, + 0x4e, 0x68, 0xdc, 0xcc, 0x5f, 0xe7, 0x49, 0xca, 0xb4, 0x7f, 0x00, 0xd8, 0x27, 0x62, 0xac, 0x88, + 0x56, 0xa1, 0x18, 0x71, 0x7a, 0xe2, 0xbf, 0x5c, 0xa0, 0xb8, 0x4e, 0x6f, 0x3a, 0xe1, 0x82, 0x2d, + 0xc8, 0x28, 0x6e, 0x5a, 0x92, 0xdd, 0x31, 0xd8, 0x25, 0x63, 0xfb, 0x57, 0x04, 0xb0, 0xc3, 0x62, + 0xa1, 0x0a, 0x60, 0xb0, 0xc7, 0x2c, 0x16, 0xef, 0x4c, 0xdf, 0x82, 0x42, 0x44, 0xc4, 0x58, 0xf3, + 0x2f, 0x2b, 0x7e, 0x43, 0xb2, 0x16, 0x60, 0xdf, 0x2c, 0x00, 0x7f, 0x08, 0xb6, 0x34, 0x3e, 0xbd, + 0x1f, 0x4b, 0x2a, 0x9f, 0x48, 0x32, 0x7c, 0x7f, 0x0a, 0xb5, 0xcd, 0x28, 0x4a, 0xaa, 0xab, 0x5d, + 0x0d, 0x28, 0x91, 0x34, 0xf0, 0xbf, 0x39, 0x71, 0x0c, 0x95, 0xcd, 0xfd, 0xdd, 0x77, 0xe8, 0xd8, + 0x32, 0x58, 0x24, 0xf2, 0xff, 0x13, 0xf7, 0x4f, 0x08, 0x8a, 0x8a, 0xf9, 0x63, 0xa8, 0x26, 0x0e, + 0x0f, 0x24, 0x24, 0x7d, 0x8a, 0x73, 0xdf, 0x8c, 0x4e, 0xdc, 0x85, 0xba, 0x3a, 0xa1, 0x86, 0xa6, + 0x6f, 0x73, 0x55, 0x41, 0x17, 0xfd, 0xf8, 0x08, 0x80, 0x44, 0xbe, 0x46, 0xa6, 0x37, 0x5e, 0xcb, + 0xc8, 0x4e, 0xd5, 0xfe, 0x02, 0xca, 0x8f, 0xa3, 0x58, 0x70, 0x4a, 0x82, 0xe4, 0x2a, 0x09, 0xc2, + 0x47, 0x74, 0xb1, 0xd7, 0xab, 0x50, 0x7c, 0x41, 0xfd, 0xd1, 0x38, 0x9d, 0x04, 0x35, 0x65, 0x3f, + 0x81, 0xd2, 0xa1, 0x1f, 0x50, 0x36, 0x15, 0x78, 0x03, 0x96, 0x3c, 0x16, 0x86, 0xd4, 0x13, 0x03, + 0x91, 0x86, 0xe4, 0xfe, 0xda, 0xbc, 0x01, 0x9c, 0x92, 0x61, 0x96, 0x33, 0x58, 0xf0, 0x7b, 0x50, + 0x7b, 0xc1, 0x7d, 0x41, 0xb3, 0xa4, 0x65, 0x94, 0xe8, 0x41, 0x79, 0x8f, 0x0a, 0x32, 0x24, 0x82, + 0xe8, 0x07, 0x6d, 0xea, 0x5a, 0xd1, 0x23, 0xce, 0x70, 0xbd, 0x7d, 0x8e, 0xa0, 0xb8, 0xe9, 0xc9, + 0x47, 0x7c, 0x17, 0xaa, 0x44, 0x7e, 0xa5, 0xaf, 0x38, 0x9d, 0x19, 0xda, 0xd5, 0x14, 0x63, 0x4c, + 0x8c, 0xcf, 0xf5, 0xcc, 0x93, 0xe0, 0xbc, 0x04, 0xaf, 0x2d, 0x80, 0xe5, 0xd8, 0xfb, 0xf7, 0x8c, + 0xb1, 0x6e, 0x92, 0x64, 0x1b, 0x92, 0xfe, 0x40, 0x50, 0x3f, 0xf2, 0xb9, 0x98, 0x92, 0xc9, 0x41, + 0x7a, 0x7f, 0x6e, 0xb8, 0x4a, 0xf9, 0x8c, 0xa3, 0x0d, 0x95, 0xa9, 0x6a, 0x88, 0x1e, 0x00, 0xfa, + 0x05, 0x64, 0x8d, 0x6a, 0x03, 0x28, 0xc3, 0x06, 0x41, 0xac, 0x5a, 0x9b, 0x4d, 0x09, 0xd5, 0x95, + 0xdb, 0x50, 0x3d, 0x61, 0xdc, 0xa3, 0x83, 0xb1, 0x10, 0x51, 0x2c, 0x15, 0x95, 0x55, 0x89, 0x0f, + 0xa0, 0x1c, 0x28, 0x63, 0x9b, 0x85, 0x85, 0x0a, 0x99, 0xdf, 0x1b, 0x50, 0x4c, 0xcd, 0x6b, 0x16, + 0x25, 0xa0, 0xb6, 0x60, 0x45, 0xfb, 0x21, 0x14, 0xb7, 0x59, 0x78, 0xe2, 0x8f, 0xb0, 0x0b, 0xa5, + 0xf4, 0x86, 0xe9, 0xa9, 0xa7, 0x91, 0xea, 0x16, 0x7e, 0x02, 0x65, 0x75, 0x54, 0x7d, 0x9a, 0x86, + 0x02, 0x2c, 0x7a, 0xd2, 0x3d, 0x47, 0x70, 0xcb, 0xfc, 0x05, 0xe0, 0x06, 0x2c, 0xeb, 0xf5, 0xe3, + 0xf0, 0x3e, 0x3d, 0xf1, 0x43, 0x3a, 0x74, 0x12, 0xdb, 0x6b, 0x3a, 0xfc, 0xf5, 0xf3, 0x29, 0x99, + 0x38, 0x08, 0xaf, 0xc0, 0x92, 0x0e, 0x7d, 0xcb, 0x29, 0x11, 0x94, 0x3b, 0x79, 0xec, 0xcc, 0xe9, + 0xfa, 0x34, 0x8e, 0x1d, 0x0b, 0x37, 0x61, 0xf5, 0x1a, 0x2c, 0x25, 0xb0, 0xcd, 0x52, 0x09, 0x36, + 0x0d, 0x17, 0xba, 0xaf, 0xe0, 0x96, 0xf9, 0x6f, 0x49, 0x28, 0xfb, 0xcc, 0xbb, 0x26, 0xa6, 0xcf, + 0xbc, 0x1d, 0x21, 0xa2, 0x1d, 0x4a, 0x86, 0x94, 0x3b, 0x48, 0x81, 0x92, 0xd0, 0xc3, 0x29, 0xe5, + 0x67, 0x4e, 0x1e, 0x2f, 0x41, 0xb5, 0xcf, 0xbc, 0xef, 0x46, 0x7e, 0xf8, 0xf2, 0x88, 0x70, 0xc7, + 0x52, 0x81, 0xef, 0xb7, 0xfc, 0x57, 0xbb, 0xe1, 0x09, 0x73, 0x6c, 0x83, 0x66, 0x9b, 0xb1, 0x67, + 0x3e, 0x75, 0x0a, 0xdd, 0x03, 0xa8, 0x64, 0x7f, 0x1a, 0x8c, 0xa1, 0x2e, 0x17, 0x66, 0xe9, 0x3a, + 0xc0, 0x93, 0x31, 0x9b, 0x50, 0x99, 0x70, 0x50, 0x82, 0x51, 0xff, 0xe4, 0xdd, 0x30, 0x8d, 0xe5, + 0x13, 0xcc, 0x1e, 0x1b, 0x6e, 0xb3, 0x20, 0x22, 0x9c, 0x3a, 0x56, 0x77, 0x03, 0xca, 0x7a, 0x8a, + 0xe2, 0x12, 0x58, 0x4f, 0xe8, 0x53, 0x27, 0x87, 0xcb, 0x60, 0xef, 0x1d, 0x3e, 0xd8, 0x77, 0x50, + 0xf7, 0x67, 0x04, 0x30, 0x7f, 0x18, 0x89, 0xad, 0xe9, 0xca, 0x2c, 0xbb, 0x06, 0x38, 0x0d, 0x6e, + 0x0e, 0x87, 0x8f, 0xe8, 0xf3, 0xec, 0xd8, 0xb7, 0xa1, 0xa1, 0xe2, 0x51, 0x44, 0x43, 0x23, 0x95, + 0xc7, 0xeb, 0xb0, 0x62, 0x6c, 0x89, 0xb5, 0x55, 0x16, 0xbe, 0x03, 0x6b, 0x8b, 0x7b, 0xb2, 0x9c, + 0x9d, 0x1c, 0x27, 0xdb, 0xb4, 0x4f, 0x38, 0x09, 0x9c, 0x42, 0xf7, 0x58, 0x0b, 0xca, 0x9e, 0x62, + 0xd2, 0x53, 0x23, 0x64, 0x0a, 0x6d, 0xc0, 0x72, 0x9a, 0x39, 0x10, 0x44, 0xf8, 0x9e, 0xcc, 0x3b, + 0x68, 0xae, 0xff, 0xfe, 0x59, 0x48, 0x02, 0x1d, 0xcf, 0x6f, 0x7d, 0x75, 0x71, 0xe9, 0xe6, 0xde, + 0x5c, 0xba, 0xb9, 0xb7, 0x97, 0x2e, 0xfa, 0x71, 0xe6, 0xa2, 0xdf, 0x66, 0x2e, 0x7a, 0x3d, 0x73, + 0xd1, 0xc5, 0xcc, 0x45, 0x7f, 0xcd, 0x5c, 0xf4, 0xf7, 0xcc, 0xcd, 0xbd, 0x9d, 0xb9, 0xe8, 0xfc, + 0xca, 0xcd, 0x5d, 0x5c, 0xb9, 0xb9, 0x37, 0x57, 0x6e, 0xee, 0xb8, 0x7c, 0xef, 0xb3, 0x2f, 0xe5, + 0x6d, 0xfe, 0x27, 0x00, 0x00, 0xff, 0xff, 0x7d, 0x6c, 0x24, 0xd1, 0x98, 0x09, 0x00, 0x00, +} + +func (x OperatorType) String() string { + s, ok := OperatorType_name[int32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} +func (x LocationType) String() string { + s, ok := LocationType_name[int32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} +func (x MatchType) String() string { + s, ok := MatchType_name[int32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} +func (x HostType) String() string { + s, ok := HostType_name[int32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} +func (x ActionType) String() string { + s, ok := ActionType_name[int32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} +func (x ActionValueType) String() string { + s, ok := ActionValueType_name[int32(x)] + if ok { + return s + } + return strconv.Itoa(int(x)) +} +func (this *TagValueStrList) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*VirtualService) + that1, ok := that.(*TagValueStrList) if !ok { - that2, ok := that.(VirtualService) + that2, ok := that.(TagValueStrList) if ok { that1 = &that2 } else { @@ -1009,41 +1423,24 @@ func (this *VirtualService) Equal(that interface{}) bool { } else if this == nil { return false } - if this.ServiceName != that1.ServiceName { - return false - } - if len(this.Upstreams) != len(that1.Upstreams) { - return false - } - for i := range this.Upstreams { - if !this.Upstreams[i].Equal(that1.Upstreams[i]) { - return false - } - } - if !this.TimeoutMs.Equal(that1.TimeoutMs) { - return false - } - if this.ForceHttps != that1.ForceHttps { - return false - } - if len(this.Metadata) != len(that1.Metadata) { + if len(this.Value) != len(that1.Value) { return false } - for i := range this.Metadata { - if !this.Metadata[i].Equal(that1.Metadata[i]) { + for i := range this.Value { + if this.Value[i] != that1.Value[i] { return false } } return true } -func (this *PathRouter) Equal(that interface{}) bool { +func (this *TagItemCondition) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*PathRouter) + that1, ok := that.(*TagItemCondition) if !ok { - that2, ok := that.(PathRouter) + that2, ok := that.(TagItemCondition) if ok { that1 = &that2 } else { @@ -1055,30 +1452,31 @@ func (this *PathRouter) Equal(that interface{}) bool { } else if this == nil { return false } - if this.Path != that1.Path { + if this.ValueStr != that1.ValueStr { return false } - if this.ServiceName != that1.ServiceName { + if !this.ValueList.Equal(that1.ValueList) { return false } - if len(this.Tags) != len(that1.Tags) { + if this.Divisor != that1.Divisor { return false } - for i := range this.Tags { - if !this.Tags[i].Equal(that1.Tags[i]) { - return false - } + if this.Remainder != that1.Remainder { + return false + } + if this.Operator != that1.Operator { + return false } return true } -func (this *HostRouter) Equal(that interface{}) bool { +func (this *TagItem) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*HostRouter) + that1, ok := that.(*TagItem) if !ok { - that2, ok := that.(HostRouter) + that2, ok := that.(TagItem) if ok { that1 = &that2 } else { @@ -1090,38 +1488,28 @@ func (this *HostRouter) Equal(that interface{}) bool { } else if this == nil { return false } - if this.Host != that1.Host { + if this.Location != that1.Location { return false } - if this.ServiceName != that1.ServiceName { + if this.Key != that1.Key { return false } - if len(this.Paths) != len(that1.Paths) { + if !this.Condition.Equal(that1.Condition) { return false } - for i := range this.Paths { - if !this.Paths[i].Equal(that1.Paths[i]) { - return false - } - } - if len(this.Tags) != len(that1.Tags) { + if this.MatchType != that1.MatchType { return false } - for i := range this.Tags { - if !this.Tags[i].Equal(that1.Tags[i]) { - return false - } - } return true } -func (this *Router) Equal(that interface{}) bool { +func (this *TagRule) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*Router) + that1, ok := that.(*TagRule) if !ok { - that2, ok := that.(Router) + that2, ok := that.(TagRule) if ok { that1 = &that2 } else { @@ -1133,19 +1521,24 @@ func (this *Router) Equal(that interface{}) bool { } else if this == nil { return false } - if !this.HostRouter.Equal(that1.HostRouter) { + if len(this.Items) != len(that1.Items) { return false } + for i := range this.Items { + if !this.Items[i].Equal(that1.Items[i]) { + return false + } + } return true } -func (this *Config) Equal(that interface{}) bool { +func (this *TagRouter) Equal(that interface{}) bool { if that == nil { return this == nil } - that1, ok := that.(*Config) + that1, ok := that.(*TagRouter) if !ok { - that2, ok := that.(Config) + that2, ok := that.(TagRouter) if ok { that1 = &that2 } else { @@ -1157,927 +1550,2562 @@ func (this *Config) Equal(that interface{}) bool { } else if this == nil { return false } - if len(this.Routers) != len(that1.Routers) { + if this.ServiceName != that1.ServiceName { return false } - for i := range this.Routers { - if !this.Routers[i].Equal(that1.Routers[i]) { - return false - } - } - if len(this.Services) != len(that1.Services) { + if len(this.Rules) != len(that1.Rules) { return false } - for i := range this.Services { - if !this.Services[i].Equal(that1.Services[i]) { + for i := range this.Rules { + if !this.Rules[i].Equal(that1.Rules[i]) { return false } } return true } -func (this *TagItem) GoString() string { - if this == nil { - return "nil" +func (this *PathRouter) Equal(that interface{}) bool { + if that == nil { + return this == nil } - s := make([]string, 0, 8) - s = append(s, "&route.TagItem{") - s = append(s, "Location: "+fmt.Sprintf("%#v", this.Location)+",\n") - s = append(s, "Key: "+fmt.Sprintf("%#v", this.Key)+",\n") - s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") - s = append(s, "MatchType: "+fmt.Sprintf("%#v", this.MatchType)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *TagRule) GoString() string { - if this == nil { - return "nil" + + that1, ok := that.(*PathRouter) + if !ok { + that2, ok := that.(PathRouter) + if ok { + that1 = &that2 + } else { + return false + } } - s := make([]string, 0, 5) - s = append(s, "&route.TagRule{") - if this.Items != nil { - s = append(s, "Items: "+fmt.Sprintf("%#v", this.Items)+",\n") + if that1 == nil { + return this == nil + } else if this == nil { + return false } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *TagRouter) GoString() string { - if this == nil { - return "nil" + if this.Prefix != that1.Prefix { + return false } - s := make([]string, 0, 6) - s = append(s, "&route.TagRouter{") - s = append(s, "ServiceName: "+fmt.Sprintf("%#v", this.ServiceName)+",\n") - if this.Rules != nil { - s = append(s, "Rules: "+fmt.Sprintf("%#v", this.Rules)+",\n") + if this.ServiceName != that1.ServiceName { + return false } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *Timeout) GoString() string { - if this == nil { - return "nil" + if len(this.Tags) != len(that1.Tags) { + return false } - s := make([]string, 0, 7) - s = append(s, "&route.Timeout{") - s = append(s, "ConnectTimeout: "+fmt.Sprintf("%#v", this.ConnectTimeout)+",\n") - s = append(s, "ReadTimeout: "+fmt.Sprintf("%#v", this.ReadTimeout)+",\n") - s = append(s, "WriteTimeout: "+fmt.Sprintf("%#v", this.WriteTimeout)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *Upstream) GoString() string { - if this == nil { - return "nil" + for i := range this.Tags { + if !this.Tags[i].Equal(that1.Tags[i]) { + return false + } } - s := make([]string, 0, 6) - s = append(s, "&route.Upstream{") - s = append(s, "Target: "+fmt.Sprintf("%#v", this.Target)+",\n") - s = append(s, "Weight: "+fmt.Sprintf("%#v", this.Weight)+",\n") - s = append(s, "}") - return strings.Join(s, "") + return true } -func (this *Metadata) GoString() string { - if this == nil { - return "nil" +func (this *HostRouter) Equal(that interface{}) bool { + if that == nil { + return this == nil } - s := make([]string, 0, 6) - s = append(s, "&route.Metadata{") - s = append(s, "Key: "+fmt.Sprintf("%#v", this.Key)+",\n") - s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *VirtualService) GoString() string { - if this == nil { - return "nil" + + that1, ok := that.(*HostRouter) + if !ok { + that2, ok := that.(HostRouter) + if ok { + that1 = &that2 + } else { + return false + } } - s := make([]string, 0, 9) - s = append(s, "&route.VirtualService{") - s = append(s, "ServiceName: "+fmt.Sprintf("%#v", this.ServiceName)+",\n") - if this.Upstreams != nil { - s = append(s, "Upstreams: "+fmt.Sprintf("%#v", this.Upstreams)+",\n") + if that1 == nil { + return this == nil + } else if this == nil { + return false } - if this.TimeoutMs != nil { - s = append(s, "TimeoutMs: "+fmt.Sprintf("%#v", this.TimeoutMs)+",\n") + if this.Host != that1.Host { + return false } - s = append(s, "ForceHttps: "+fmt.Sprintf("%#v", this.ForceHttps)+",\n") - if this.Metadata != nil { - s = append(s, "Metadata: "+fmt.Sprintf("%#v", this.Metadata)+",\n") + if this.ServiceName != that1.ServiceName { + return false } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *PathRouter) GoString() string { - if this == nil { - return "nil" + if len(this.Paths) != len(that1.Paths) { + return false } - s := make([]string, 0, 7) - s = append(s, "&route.PathRouter{") - s = append(s, "Path: "+fmt.Sprintf("%#v", this.Path)+",\n") - s = append(s, "ServiceName: "+fmt.Sprintf("%#v", this.ServiceName)+",\n") - if this.Tags != nil { - s = append(s, "Tags: "+fmt.Sprintf("%#v", this.Tags)+",\n") + for i := range this.Paths { + if !this.Paths[i].Equal(that1.Paths[i]) { + return false + } } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *HostRouter) GoString() string { - if this == nil { - return "nil" + if len(this.Tags) != len(that1.Tags) { + return false } - s := make([]string, 0, 8) - s = append(s, "&route.HostRouter{") - s = append(s, "Host: "+fmt.Sprintf("%#v", this.Host)+",\n") - s = append(s, "ServiceName: "+fmt.Sprintf("%#v", this.ServiceName)+",\n") - if this.Paths != nil { - s = append(s, "Paths: "+fmt.Sprintf("%#v", this.Paths)+",\n") + for i := range this.Tags { + if !this.Tags[i].Equal(that1.Tags[i]) { + return false + } } - if this.Tags != nil { - s = append(s, "Tags: "+fmt.Sprintf("%#v", this.Tags)+",\n") + if this.Type != that1.Type { + return false } - s = append(s, "}") - return strings.Join(s, "") + return true } -func (this *Router) GoString() string { - if this == nil { - return "nil" +func (this *AppnameRouter) Equal(that interface{}) bool { + if that == nil { + return this == nil } - s := make([]string, 0, 5) - s = append(s, "&route.Router{") - if this.HostRouter != nil { - s = append(s, "HostRouter: "+fmt.Sprintf("%#v", this.HostRouter)+",\n") + + that1, ok := that.(*AppnameRouter) + if !ok { + that2, ok := that.(AppnameRouter) + if ok { + that1 = &that2 + } else { + return false + } } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *Config) GoString() string { - if this == nil { - return "nil" + if that1 == nil { + return this == nil + } else if this == nil { + return false } - s := make([]string, 0, 6) - s = append(s, "&route.Config{") - if this.Routers != nil { - s = append(s, "Routers: "+fmt.Sprintf("%#v", this.Routers)+",\n") + if this.Appname != that1.Appname { + return false } - if this.Services != nil { - s = append(s, "Services: "+fmt.Sprintf("%#v", this.Services)+",\n") + if this.ServiceName != that1.ServiceName { + return false } - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringRoute(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" + if len(this.Tags) != len(that1.Tags) { + return false } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func (m *TagItem) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err + for i := range this.Tags { + if !this.Tags[i].Equal(that1.Tags[i]) { + return false + } } - return dAtA[:n], nil + return true } +func (this *APIRouter) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *TagItem) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - dAtA[i] = 0x8 - i++ - i = encodeVarintRoute(dAtA, i, uint64(m.Location)) - dAtA[i] = 0x12 - i++ - i = encodeVarintRoute(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - dAtA[i] = 0x1a - i++ - i = encodeVarintRoute(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - dAtA[i] = 0x20 - i++ - i = encodeVarintRoute(dAtA, i, uint64(m.MatchType)) - return i, nil -} - -func (m *TagRule) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err + that1, ok := that.(*APIRouter) + if !ok { + that2, ok := that.(APIRouter) + if ok { + that1 = &that2 + } else { + return false + } } - return dAtA[:n], nil -} - -func (m *TagRule) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Items) > 0 { - for _, msg := range m.Items { - dAtA[i] = 0xa - i++ - i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ServiceName != that1.ServiceName { + return false + } + if this.Api != that1.Api { + return false + } + if len(this.Tags) != len(that1.Tags) { + return false + } + for i := range this.Tags { + if !this.Tags[i].Equal(that1.Tags[i]) { + return false } } - return i, nil + return true } +func (this *Router) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *TagRouter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err + that1, ok := that.(*Router) + if !ok { + that2, ok := that.(Router) + if ok { + that1 = &that2 + } else { + return false + } } - return dAtA[:n], nil + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if !this.HostRouter.Equal(that1.HostRouter) { + return false + } + if !this.AppnameRouter.Equal(that1.AppnameRouter) { + return false + } + if !this.ApiRouter.Equal(that1.ApiRouter) { + return false + } + return true } +func (this *Upstream) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *TagRouter) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintRoute(dAtA, i, uint64(len(m.ServiceName))) - i += copy(dAtA[i:], m.ServiceName) - if len(m.Rules) > 0 { - for _, msg := range m.Rules { - dAtA[i] = 0x12 - i++ - i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n + that1, ok := that.(*Upstream) + if !ok { + that2, ok := that.(Upstream) + if ok { + that1 = &that2 + } else { + return false } } - return i, nil + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Target != that1.Target { + return false + } + if this.Weight != that1.Weight { + return false + } + return true } +func (this *Timeout) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *Timeout) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err + that1, ok := that.(*Timeout) + if !ok { + that2, ok := that.(Timeout) + if ok { + that1 = &that2 + } else { + return false + } } - return dAtA[:n], nil + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ConnectTimeout != that1.ConnectTimeout { + return false + } + if this.ReadTimeout != that1.ReadTimeout { + return false + } + if this.WriteTimeout != that1.WriteTimeout { + return false + } + return true } +func (this *Metadata) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *Timeout) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - dAtA[i] = 0x8 - i++ - i = encodeVarintRoute(dAtA, i, uint64(m.ConnectTimeout)) - dAtA[i] = 0x10 - i++ - i = encodeVarintRoute(dAtA, i, uint64(m.ReadTimeout)) - dAtA[i] = 0x18 - i++ - i = encodeVarintRoute(dAtA, i, uint64(m.WriteTimeout)) - return i, nil + that1, ok := that.(*Metadata) + if !ok { + that2, ok := that.(Metadata) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.Key != that1.Key { + return false + } + if this.Value != that1.Value { + return false + } + return true } +func (this *Action) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *Upstream) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err + that1, ok := that.(*Action) + if !ok { + that2, ok := that.(Action) + if ok { + that1 = &that2 + } else { + return false + } } - return dAtA[:n], nil + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ActionType != that1.ActionType { + return false + } + if this.ValueType != that1.ValueType { + return false + } + if this.Key != that1.Key { + return false + } + if this.Value != that1.Value { + return false + } + return true } +func (this *VirtualService) Equal(that interface{}) bool { + if that == nil { + return this == nil + } -func (m *Upstream) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintRoute(dAtA, i, uint64(len(m.Target))) - i += copy(dAtA[i:], m.Target) - dAtA[i] = 0x10 - i++ - i = encodeVarintRoute(dAtA, i, uint64(m.Weight)) - return i, nil -} - -func (m *Metadata) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err + that1, ok := that.(*VirtualService) + if !ok { + that2, ok := that.(VirtualService) + if ok { + that1 = &that2 + } else { + return false + } } - return dAtA[:n], nil -} - -func (m *Metadata) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintRoute(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - dAtA[i] = 0x12 - i++ - i = encodeVarintRoute(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - return i, nil -} - -func (m *VirtualService) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err + if that1 == nil { + return this == nil + } else if this == nil { + return false } - return dAtA[:n], nil -} - -func (m *VirtualService) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintRoute(dAtA, i, uint64(len(m.ServiceName))) - i += copy(dAtA[i:], m.ServiceName) - if len(m.Upstreams) > 0 { - for _, msg := range m.Upstreams { - dAtA[i] = 0x12 - i++ - i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } + if this.ServiceName != that1.ServiceName { + return false } - if m.TimeoutMs != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintRoute(dAtA, i, uint64(m.TimeoutMs.Size())) - n1, err := m.TimeoutMs.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if len(this.Upstreams) != len(that1.Upstreams) { + return false + } + for i := range this.Upstreams { + if !this.Upstreams[i].Equal(that1.Upstreams[i]) { + return false } - i += n1 } - dAtA[i] = 0x20 - i++ - if m.ForceHttps { - dAtA[i] = 1 - } else { - dAtA[i] = 0 + if !this.TimeoutMs.Equal(that1.TimeoutMs) { + return false } - i++ - if len(m.Metadata) > 0 { - for _, msg := range m.Metadata { - dAtA[i] = 0x2a - i++ - i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n + if this.ForceHttps != that1.ForceHttps { + return false + } + if len(this.Metadata) != len(that1.Metadata) { + return false + } + for i := range this.Metadata { + if !this.Metadata[i].Equal(that1.Metadata[i]) { + return false } } - return i, nil -} - -func (m *PathRouter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err + if len(this.Action) != len(that1.Action) { + return false } - return dAtA[:n], nil -} - -func (m *PathRouter) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintRoute(dAtA, i, uint64(len(m.Path))) - i += copy(dAtA[i:], m.Path) - dAtA[i] = 0x12 - i++ - i = encodeVarintRoute(dAtA, i, uint64(len(m.ServiceName))) - i += copy(dAtA[i:], m.ServiceName) - if len(m.Tags) > 0 { - for _, msg := range m.Tags { - dAtA[i] = 0x1a - i++ - i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n + for i := range this.Action { + if !this.Action[i].Equal(that1.Action[i]) { + return false } } - return i, nil + return true } - -func (m *HostRouter) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err +func (this *Config) Equal(that interface{}) bool { + if that == nil { + return this == nil } - return dAtA[:n], nil -} -func (m *HostRouter) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintRoute(dAtA, i, uint64(len(m.Host))) - i += copy(dAtA[i:], m.Host) - dAtA[i] = 0x12 - i++ - i = encodeVarintRoute(dAtA, i, uint64(len(m.ServiceName))) - i += copy(dAtA[i:], m.ServiceName) - if len(m.Paths) > 0 { - for _, msg := range m.Paths { - dAtA[i] = 0x1a - i++ - i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n + that1, ok := that.(*Config) + if !ok { + that2, ok := that.(Config) + if ok { + that1 = &that2 + } else { + return false } } - if len(m.Tags) > 0 { - for _, msg := range m.Tags { - dAtA[i] = 0x22 - i++ - i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if len(this.Routers) != len(that1.Routers) { + return false + } + for i := range this.Routers { + if !this.Routers[i].Equal(that1.Routers[i]) { + return false } } - return i, nil -} - -func (m *Router) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err + if len(this.Services) != len(that1.Services) { + return false } - return dAtA[:n], nil -} - -func (m *Router) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.HostRouter != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintRoute(dAtA, i, uint64(m.HostRouter.Size())) - n2, err := m.HostRouter.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for i := range this.Services { + if !this.Services[i].Equal(that1.Services[i]) { + return false } - i += n2 } - return i, nil + return true } - -func (m *Config) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err +func (this *TagValueStrList) GoString() string { + if this == nil { + return "nil" } - return dAtA[:n], nil -} - -func (m *Config) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Routers) > 0 { - for _, msg := range m.Routers { - dAtA[i] = 0xa - i++ - i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if len(m.Services) > 0 { - for _, msg := range m.Services { - dAtA[i] = 0x12 - i++ - i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } + s := make([]string, 0, 5) + s = append(s, "&route.TagValueStrList{") + if this.Value != nil { + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") } - return i, nil + s = append(s, "}") + return strings.Join(s, "") } - -func encodeVarintRoute(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (this *TagItemCondition) GoString() string { + if this == nil { + return "nil" } - dAtA[offset] = uint8(v) - return offset + 1 + s := make([]string, 0, 9) + s = append(s, "&route.TagItemCondition{") + s = append(s, "ValueStr: "+fmt.Sprintf("%#v", this.ValueStr)+",\n") + if this.ValueList != nil { + s = append(s, "ValueList: "+fmt.Sprintf("%#v", this.ValueList)+",\n") + } + s = append(s, "Divisor: "+fmt.Sprintf("%#v", this.Divisor)+",\n") + s = append(s, "Remainder: "+fmt.Sprintf("%#v", this.Remainder)+",\n") + s = append(s, "Operator: "+fmt.Sprintf("%#v", this.Operator)+",\n") + s = append(s, "}") + return strings.Join(s, "") } -func (m *TagItem) Size() (n int) { - if m == nil { - return 0 +func (this *TagItem) GoString() string { + if this == nil { + return "nil" } - var l int - _ = l - n += 1 + sovRoute(uint64(m.Location)) - l = len(m.Key) - n += 1 + l + sovRoute(uint64(l)) - l = len(m.Value) - n += 1 + l + sovRoute(uint64(l)) - n += 1 + sovRoute(uint64(m.MatchType)) - return n + s := make([]string, 0, 8) + s = append(s, "&route.TagItem{") + s = append(s, "Location: "+fmt.Sprintf("%#v", this.Location)+",\n") + s = append(s, "Key: "+fmt.Sprintf("%#v", this.Key)+",\n") + if this.Condition != nil { + s = append(s, "Condition: "+fmt.Sprintf("%#v", this.Condition)+",\n") + } + s = append(s, "MatchType: "+fmt.Sprintf("%#v", this.MatchType)+",\n") + s = append(s, "}") + return strings.Join(s, "") } - -func (m *TagRule) Size() (n int) { - if m == nil { - return 0 +func (this *TagRule) GoString() string { + if this == nil { + return "nil" } - var l int - _ = l - if len(m.Items) > 0 { - for _, e := range m.Items { - l = e.Size() - n += 1 + l + sovRoute(uint64(l)) - } + s := make([]string, 0, 5) + s = append(s, "&route.TagRule{") + if this.Items != nil { + s = append(s, "Items: "+fmt.Sprintf("%#v", this.Items)+",\n") } - return n + s = append(s, "}") + return strings.Join(s, "") } - -func (m *TagRouter) Size() (n int) { - if m == nil { - return 0 +func (this *TagRouter) GoString() string { + if this == nil { + return "nil" } - var l int - _ = l - l = len(m.ServiceName) - n += 1 + l + sovRoute(uint64(l)) - if len(m.Rules) > 0 { - for _, e := range m.Rules { - l = e.Size() - n += 1 + l + sovRoute(uint64(l)) - } + s := make([]string, 0, 6) + s = append(s, "&route.TagRouter{") + s = append(s, "ServiceName: "+fmt.Sprintf("%#v", this.ServiceName)+",\n") + if this.Rules != nil { + s = append(s, "Rules: "+fmt.Sprintf("%#v", this.Rules)+",\n") } - return n + s = append(s, "}") + return strings.Join(s, "") } - -func (m *Timeout) Size() (n int) { - if m == nil { - return 0 +func (this *PathRouter) GoString() string { + if this == nil { + return "nil" } - var l int - _ = l - n += 1 + sovRoute(uint64(m.ConnectTimeout)) - n += 1 + sovRoute(uint64(m.ReadTimeout)) - n += 1 + sovRoute(uint64(m.WriteTimeout)) - return n -} - -func (m *Upstream) Size() (n int) { - if m == nil { - return 0 + s := make([]string, 0, 7) + s = append(s, "&route.PathRouter{") + s = append(s, "Prefix: "+fmt.Sprintf("%#v", this.Prefix)+",\n") + s = append(s, "ServiceName: "+fmt.Sprintf("%#v", this.ServiceName)+",\n") + if this.Tags != nil { + s = append(s, "Tags: "+fmt.Sprintf("%#v", this.Tags)+",\n") } - var l int - _ = l - l = len(m.Target) - n += 1 + l + sovRoute(uint64(l)) - n += 1 + sovRoute(uint64(m.Weight)) - return n + s = append(s, "}") + return strings.Join(s, "") } - -func (m *Metadata) Size() (n int) { - if m == nil { - return 0 +func (this *HostRouter) GoString() string { + if this == nil { + return "nil" } - var l int - _ = l - l = len(m.Key) - n += 1 + l + sovRoute(uint64(l)) - l = len(m.Value) - n += 1 + l + sovRoute(uint64(l)) - return n -} - -func (m *VirtualService) Size() (n int) { - if m == nil { - return 0 + s := make([]string, 0, 9) + s = append(s, "&route.HostRouter{") + s = append(s, "Host: "+fmt.Sprintf("%#v", this.Host)+",\n") + s = append(s, "ServiceName: "+fmt.Sprintf("%#v", this.ServiceName)+",\n") + if this.Paths != nil { + s = append(s, "Paths: "+fmt.Sprintf("%#v", this.Paths)+",\n") } - var l int - _ = l - l = len(m.ServiceName) - n += 1 + l + sovRoute(uint64(l)) - if len(m.Upstreams) > 0 { - for _, e := range m.Upstreams { - l = e.Size() - n += 1 + l + sovRoute(uint64(l)) - } + if this.Tags != nil { + s = append(s, "Tags: "+fmt.Sprintf("%#v", this.Tags)+",\n") } - if m.TimeoutMs != nil { - l = m.TimeoutMs.Size() - n += 1 + l + sovRoute(uint64(l)) + s = append(s, "Type: "+fmt.Sprintf("%#v", this.Type)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *AppnameRouter) GoString() string { + if this == nil { + return "nil" } - n += 2 - if len(m.Metadata) > 0 { - for _, e := range m.Metadata { - l = e.Size() - n += 1 + l + sovRoute(uint64(l)) - } + s := make([]string, 0, 7) + s = append(s, "&route.AppnameRouter{") + s = append(s, "Appname: "+fmt.Sprintf("%#v", this.Appname)+",\n") + s = append(s, "ServiceName: "+fmt.Sprintf("%#v", this.ServiceName)+",\n") + if this.Tags != nil { + s = append(s, "Tags: "+fmt.Sprintf("%#v", this.Tags)+",\n") } - return n + s = append(s, "}") + return strings.Join(s, "") } - -func (m *PathRouter) Size() (n int) { - if m == nil { - return 0 +func (this *APIRouter) GoString() string { + if this == nil { + return "nil" } - var l int - _ = l - l = len(m.Path) - n += 1 + l + sovRoute(uint64(l)) - l = len(m.ServiceName) - n += 1 + l + sovRoute(uint64(l)) - if len(m.Tags) > 0 { - for _, e := range m.Tags { - l = e.Size() - n += 1 + l + sovRoute(uint64(l)) - } + s := make([]string, 0, 7) + s = append(s, "&route.APIRouter{") + s = append(s, "ServiceName: "+fmt.Sprintf("%#v", this.ServiceName)+",\n") + s = append(s, "Api: "+fmt.Sprintf("%#v", this.Api)+",\n") + if this.Tags != nil { + s = append(s, "Tags: "+fmt.Sprintf("%#v", this.Tags)+",\n") } - return n + s = append(s, "}") + return strings.Join(s, "") } - -func (m *HostRouter) Size() (n int) { - if m == nil { - return 0 +func (this *Router) GoString() string { + if this == nil { + return "nil" } - var l int - _ = l - l = len(m.Host) - n += 1 + l + sovRoute(uint64(l)) - l = len(m.ServiceName) - n += 1 + l + sovRoute(uint64(l)) - if len(m.Paths) > 0 { - for _, e := range m.Paths { - l = e.Size() - n += 1 + l + sovRoute(uint64(l)) - } + s := make([]string, 0, 7) + s = append(s, "&route.Router{") + if this.HostRouter != nil { + s = append(s, "HostRouter: "+fmt.Sprintf("%#v", this.HostRouter)+",\n") } - if len(m.Tags) > 0 { - for _, e := range m.Tags { - l = e.Size() - n += 1 + l + sovRoute(uint64(l)) - } + if this.AppnameRouter != nil { + s = append(s, "AppnameRouter: "+fmt.Sprintf("%#v", this.AppnameRouter)+",\n") } - return n -} - -func (m *Router) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.HostRouter != nil { - l = m.HostRouter.Size() - n += 1 + l + sovRoute(uint64(l)) - } - return n -} - -func (m *Config) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Routers) > 0 { - for _, e := range m.Routers { - l = e.Size() - n += 1 + l + sovRoute(uint64(l)) - } - } - if len(m.Services) > 0 { - for _, e := range m.Services { - l = e.Size() - n += 1 + l + sovRoute(uint64(l)) - } - } - return n -} - -func sovRoute(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } + if this.ApiRouter != nil { + s = append(s, "ApiRouter: "+fmt.Sprintf("%#v", this.ApiRouter)+",\n") } - return n -} -func sozRoute(x uint64) (n int) { - return sovRoute(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + s = append(s, "}") + return strings.Join(s, "") } -func (this *TagItem) String() string { +func (this *Upstream) GoString() string { if this == nil { return "nil" } - s := strings.Join([]string{`&TagItem{`, - `Location:` + fmt.Sprintf("%v", this.Location) + `,`, - `Key:` + fmt.Sprintf("%v", this.Key) + `,`, - `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `MatchType:` + fmt.Sprintf("%v", this.MatchType) + `,`, - `}`, - }, "") - return s + s := make([]string, 0, 6) + s = append(s, "&route.Upstream{") + s = append(s, "Target: "+fmt.Sprintf("%#v", this.Target)+",\n") + s = append(s, "Weight: "+fmt.Sprintf("%#v", this.Weight)+",\n") + s = append(s, "}") + return strings.Join(s, "") } -func (this *TagRule) String() string { +func (this *Timeout) GoString() string { if this == nil { return "nil" } - s := strings.Join([]string{`&TagRule{`, - `Items:` + strings.Replace(fmt.Sprintf("%v", this.Items), "TagItem", "TagItem", 1) + `,`, - `}`, - }, "") - return s + s := make([]string, 0, 7) + s = append(s, "&route.Timeout{") + s = append(s, "ConnectTimeout: "+fmt.Sprintf("%#v", this.ConnectTimeout)+",\n") + s = append(s, "ReadTimeout: "+fmt.Sprintf("%#v", this.ReadTimeout)+",\n") + s = append(s, "WriteTimeout: "+fmt.Sprintf("%#v", this.WriteTimeout)+",\n") + s = append(s, "}") + return strings.Join(s, "") } -func (this *TagRouter) String() string { +func (this *Metadata) GoString() string { if this == nil { return "nil" } - s := strings.Join([]string{`&TagRouter{`, - `ServiceName:` + fmt.Sprintf("%v", this.ServiceName) + `,`, - `Rules:` + strings.Replace(fmt.Sprintf("%v", this.Rules), "TagRule", "TagRule", 1) + `,`, - `}`, - }, "") - return s + s := make([]string, 0, 6) + s = append(s, "&route.Metadata{") + s = append(s, "Key: "+fmt.Sprintf("%#v", this.Key)+",\n") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + s = append(s, "}") + return strings.Join(s, "") } -func (this *Timeout) String() string { +func (this *Action) GoString() string { if this == nil { return "nil" } - s := strings.Join([]string{`&Timeout{`, - `ConnectTimeout:` + fmt.Sprintf("%v", this.ConnectTimeout) + `,`, - `ReadTimeout:` + fmt.Sprintf("%v", this.ReadTimeout) + `,`, - `WriteTimeout:` + fmt.Sprintf("%v", this.WriteTimeout) + `,`, - `}`, - }, "") - return s + s := make([]string, 0, 8) + s = append(s, "&route.Action{") + s = append(s, "ActionType: "+fmt.Sprintf("%#v", this.ActionType)+",\n") + s = append(s, "ValueType: "+fmt.Sprintf("%#v", this.ValueType)+",\n") + s = append(s, "Key: "+fmt.Sprintf("%#v", this.Key)+",\n") + s = append(s, "Value: "+fmt.Sprintf("%#v", this.Value)+",\n") + s = append(s, "}") + return strings.Join(s, "") } -func (this *Upstream) String() string { +func (this *VirtualService) GoString() string { if this == nil { return "nil" } - s := strings.Join([]string{`&Upstream{`, - `Target:` + fmt.Sprintf("%v", this.Target) + `,`, - `Weight:` + fmt.Sprintf("%v", this.Weight) + `,`, - `}`, - }, "") - return s + s := make([]string, 0, 10) + s = append(s, "&route.VirtualService{") + s = append(s, "ServiceName: "+fmt.Sprintf("%#v", this.ServiceName)+",\n") + if this.Upstreams != nil { + s = append(s, "Upstreams: "+fmt.Sprintf("%#v", this.Upstreams)+",\n") + } + if this.TimeoutMs != nil { + s = append(s, "TimeoutMs: "+fmt.Sprintf("%#v", this.TimeoutMs)+",\n") + } + s = append(s, "ForceHttps: "+fmt.Sprintf("%#v", this.ForceHttps)+",\n") + if this.Metadata != nil { + s = append(s, "Metadata: "+fmt.Sprintf("%#v", this.Metadata)+",\n") + } + if this.Action != nil { + s = append(s, "Action: "+fmt.Sprintf("%#v", this.Action)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") } -func (this *Metadata) String() string { +func (this *Config) GoString() string { if this == nil { return "nil" } - s := strings.Join([]string{`&Metadata{`, - `Key:` + fmt.Sprintf("%v", this.Key) + `,`, - `Value:` + fmt.Sprintf("%v", this.Value) + `,`, - `}`, - }, "") - return s + s := make([]string, 0, 6) + s = append(s, "&route.Config{") + if this.Routers != nil { + s = append(s, "Routers: "+fmt.Sprintf("%#v", this.Routers)+",\n") + } + if this.Services != nil { + s = append(s, "Services: "+fmt.Sprintf("%#v", this.Services)+",\n") + } + s = append(s, "}") + return strings.Join(s, "") } -func (this *VirtualService) String() string { - if this == nil { +func valueToGoStringRoute(v interface{}, typ string) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { return "nil" } - s := strings.Join([]string{`&VirtualService{`, - `ServiceName:` + fmt.Sprintf("%v", this.ServiceName) + `,`, - `Upstreams:` + strings.Replace(fmt.Sprintf("%v", this.Upstreams), "Upstream", "Upstream", 1) + `,`, - `TimeoutMs:` + strings.Replace(fmt.Sprintf("%v", this.TimeoutMs), "Timeout", "Timeout", 1) + `,`, - `ForceHttps:` + fmt.Sprintf("%v", this.ForceHttps) + `,`, - `Metadata:` + strings.Replace(fmt.Sprintf("%v", this.Metadata), "Metadata", "Metadata", 1) + `,`, - `}`, - }, "") - return s + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) } -func (this *PathRouter) String() string { - if this == nil { - return "nil" +func (m *TagValueStrList) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err } - s := strings.Join([]string{`&PathRouter{`, - `Path:` + fmt.Sprintf("%v", this.Path) + `,`, - `ServiceName:` + fmt.Sprintf("%v", this.ServiceName) + `,`, - `Tags:` + strings.Replace(fmt.Sprintf("%v", this.Tags), "TagRouter", "TagRouter", 1) + `,`, - `}`, - }, "") - return s + return dAtA[:n], nil } -func (this *HostRouter) String() string { - if this == nil { - return "nil" + +func (m *TagValueStrList) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Value) > 0 { + for _, s := range m.Value { + dAtA[i] = 0xa + i++ + l = len(s) + for l >= 1<<7 { + dAtA[i] = uint8(uint64(l)&0x7f | 0x80) + l >>= 7 + i++ + } + dAtA[i] = uint8(l) + i++ + i += copy(dAtA[i:], s) + } } - s := strings.Join([]string{`&HostRouter{`, - `Host:` + fmt.Sprintf("%v", this.Host) + `,`, - `ServiceName:` + fmt.Sprintf("%v", this.ServiceName) + `,`, - `Paths:` + strings.Replace(fmt.Sprintf("%v", this.Paths), "PathRouter", "PathRouter", 1) + `,`, - `Tags:` + strings.Replace(fmt.Sprintf("%v", this.Tags), "TagRouter", "TagRouter", 1) + `,`, - `}`, - }, "") - return s + return i, nil } -func (this *Router) String() string { - if this == nil { - return "nil" + +func (m *TagItemCondition) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err } - s := strings.Join([]string{`&Router{`, - `HostRouter:` + strings.Replace(fmt.Sprintf("%v", this.HostRouter), "HostRouter", "HostRouter", 1) + `,`, - `}`, - }, "") - return s + return dAtA[:n], nil } -func (this *Config) String() string { - if this == nil { - return "nil" + +func (m *TagItemCondition) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.ValueStr))) + i += copy(dAtA[i:], m.ValueStr) + if m.ValueList != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.ValueList.Size())) + n1, err := m.ValueList.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n1 + } + dAtA[i] = 0x18 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Divisor)) + dAtA[i] = 0x20 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Remainder)) + dAtA[i] = 0x28 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Operator)) + return i, nil +} + +func (m *TagItem) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TagItem) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0x8 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Location)) + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + if m.Condition != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Condition.Size())) + n2, err := m.Condition.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n2 + } + dAtA[i] = 0x20 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.MatchType)) + return i, nil +} + +func (m *TagRule) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TagRule) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Items) > 0 { + for _, msg := range m.Items { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *TagRouter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TagRouter) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.ServiceName))) + i += copy(dAtA[i:], m.ServiceName) + if len(m.Rules) > 0 { + for _, msg := range m.Rules { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *PathRouter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PathRouter) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Prefix))) + i += copy(dAtA[i:], m.Prefix) + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.ServiceName))) + i += copy(dAtA[i:], m.ServiceName) + if len(m.Tags) > 0 { + for _, msg := range m.Tags { + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *HostRouter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HostRouter) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Host))) + i += copy(dAtA[i:], m.Host) + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.ServiceName))) + i += copy(dAtA[i:], m.ServiceName) + if len(m.Paths) > 0 { + for _, msg := range m.Paths { + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.Tags) > 0 { + for _, msg := range m.Tags { + dAtA[i] = 0x22 + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + dAtA[i] = 0x28 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Type)) + return i, nil +} + +func (m *AppnameRouter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *AppnameRouter) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Appname))) + i += copy(dAtA[i:], m.Appname) + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.ServiceName))) + i += copy(dAtA[i:], m.ServiceName) + if len(m.Tags) > 0 { + for _, msg := range m.Tags { + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *APIRouter) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *APIRouter) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.ServiceName))) + i += copy(dAtA[i:], m.ServiceName) + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Api))) + i += copy(dAtA[i:], m.Api) + if len(m.Tags) > 0 { + for _, msg := range m.Tags { + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *Router) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Router) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if m.HostRouter != nil { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.HostRouter.Size())) + n3, err := m.HostRouter.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n3 + } + if m.AppnameRouter != nil { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.AppnameRouter.Size())) + n4, err := m.AppnameRouter.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n4 + } + if m.ApiRouter != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.ApiRouter.Size())) + n5, err := m.ApiRouter.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n5 + } + return i, nil +} + +func (m *Upstream) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Upstream) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Target))) + i += copy(dAtA[i:], m.Target) + dAtA[i] = 0x10 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.Weight)) + return i, nil +} + +func (m *Timeout) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Timeout) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0x8 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.ConnectTimeout)) + dAtA[i] = 0x10 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.ReadTimeout)) + dAtA[i] = 0x18 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.WriteTimeout)) + return i, nil +} + +func (m *Metadata) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Metadata) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Value))) + i += copy(dAtA[i:], m.Value) + return i, nil +} + +func (m *Action) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Action) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0x8 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.ActionType)) + dAtA[i] = 0x10 + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.ValueType)) + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Key))) + i += copy(dAtA[i:], m.Key) + dAtA[i] = 0x22 + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.Value))) + i += copy(dAtA[i:], m.Value) + return i, nil +} + +func (m *VirtualService) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VirtualService) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(len(m.ServiceName))) + i += copy(dAtA[i:], m.ServiceName) + if len(m.Upstreams) > 0 { + for _, msg := range m.Upstreams { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if m.TimeoutMs != nil { + dAtA[i] = 0x1a + i++ + i = encodeVarintRoute(dAtA, i, uint64(m.TimeoutMs.Size())) + n6, err := m.TimeoutMs.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n6 + } + dAtA[i] = 0x20 + i++ + if m.ForceHttps { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i++ + if len(m.Metadata) > 0 { + for _, msg := range m.Metadata { + dAtA[i] = 0x2a + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.Action) > 0 { + for _, msg := range m.Action { + dAtA[i] = 0x32 + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func (m *Config) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalTo(dAtA) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Config) MarshalTo(dAtA []byte) (int, error) { + var i int + _ = i + var l int + _ = l + if len(m.Routers) > 0 { + for _, msg := range m.Routers { + dAtA[i] = 0xa + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + if len(m.Services) > 0 { + for _, msg := range m.Services { + dAtA[i] = 0x12 + i++ + i = encodeVarintRoute(dAtA, i, uint64(msg.Size())) + n, err := msg.MarshalTo(dAtA[i:]) + if err != nil { + return 0, err + } + i += n + } + } + return i, nil +} + +func encodeVarintRoute(dAtA []byte, offset int, v uint64) int { + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return offset + 1 +} +func (m *TagValueStrList) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Value) > 0 { + for _, s := range m.Value { + l = len(s) + n += 1 + l + sovRoute(uint64(l)) + } + } + return n +} + +func (m *TagItemCondition) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ValueStr) + n += 1 + l + sovRoute(uint64(l)) + if m.ValueList != nil { + l = m.ValueList.Size() + n += 1 + l + sovRoute(uint64(l)) + } + n += 1 + sovRoute(uint64(m.Divisor)) + n += 1 + sovRoute(uint64(m.Remainder)) + n += 1 + sovRoute(uint64(m.Operator)) + return n +} + +func (m *TagItem) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + sovRoute(uint64(m.Location)) + l = len(m.Key) + n += 1 + l + sovRoute(uint64(l)) + if m.Condition != nil { + l = m.Condition.Size() + n += 1 + l + sovRoute(uint64(l)) + } + n += 1 + sovRoute(uint64(m.MatchType)) + return n +} + +func (m *TagRule) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Items) > 0 { + for _, e := range m.Items { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + return n +} + +func (m *TagRouter) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServiceName) + n += 1 + l + sovRoute(uint64(l)) + if len(m.Rules) > 0 { + for _, e := range m.Rules { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + return n +} + +func (m *PathRouter) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Prefix) + n += 1 + l + sovRoute(uint64(l)) + l = len(m.ServiceName) + n += 1 + l + sovRoute(uint64(l)) + if len(m.Tags) > 0 { + for _, e := range m.Tags { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + return n +} + +func (m *HostRouter) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Host) + n += 1 + l + sovRoute(uint64(l)) + l = len(m.ServiceName) + n += 1 + l + sovRoute(uint64(l)) + if len(m.Paths) > 0 { + for _, e := range m.Paths { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + if len(m.Tags) > 0 { + for _, e := range m.Tags { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + n += 1 + sovRoute(uint64(m.Type)) + return n +} + +func (m *AppnameRouter) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Appname) + n += 1 + l + sovRoute(uint64(l)) + l = len(m.ServiceName) + n += 1 + l + sovRoute(uint64(l)) + if len(m.Tags) > 0 { + for _, e := range m.Tags { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + return n +} + +func (m *APIRouter) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServiceName) + n += 1 + l + sovRoute(uint64(l)) + l = len(m.Api) + n += 1 + l + sovRoute(uint64(l)) + if len(m.Tags) > 0 { + for _, e := range m.Tags { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + return n +} + +func (m *Router) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.HostRouter != nil { + l = m.HostRouter.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if m.AppnameRouter != nil { + l = m.AppnameRouter.Size() + n += 1 + l + sovRoute(uint64(l)) + } + if m.ApiRouter != nil { + l = m.ApiRouter.Size() + n += 1 + l + sovRoute(uint64(l)) + } + return n +} + +func (m *Upstream) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Target) + n += 1 + l + sovRoute(uint64(l)) + n += 1 + sovRoute(uint64(m.Weight)) + return n +} + +func (m *Timeout) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + sovRoute(uint64(m.ConnectTimeout)) + n += 1 + sovRoute(uint64(m.ReadTimeout)) + n += 1 + sovRoute(uint64(m.WriteTimeout)) + return n +} + +func (m *Metadata) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Key) + n += 1 + l + sovRoute(uint64(l)) + l = len(m.Value) + n += 1 + l + sovRoute(uint64(l)) + return n +} + +func (m *Action) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + sovRoute(uint64(m.ActionType)) + n += 1 + sovRoute(uint64(m.ValueType)) + l = len(m.Key) + n += 1 + l + sovRoute(uint64(l)) + l = len(m.Value) + n += 1 + l + sovRoute(uint64(l)) + return n +} + +func (m *VirtualService) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ServiceName) + n += 1 + l + sovRoute(uint64(l)) + if len(m.Upstreams) > 0 { + for _, e := range m.Upstreams { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + if m.TimeoutMs != nil { + l = m.TimeoutMs.Size() + n += 1 + l + sovRoute(uint64(l)) + } + n += 2 + if len(m.Metadata) > 0 { + for _, e := range m.Metadata { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + if len(m.Action) > 0 { + for _, e := range m.Action { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + return n +} + +func (m *Config) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Routers) > 0 { + for _, e := range m.Routers { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + if len(m.Services) > 0 { + for _, e := range m.Services { + l = e.Size() + n += 1 + l + sovRoute(uint64(l)) + } + } + return n +} + +func sovRoute(x uint64) (n int) { + for { + n++ + x >>= 7 + if x == 0 { + break + } + } + return n +} +func sozRoute(x uint64) (n int) { + return sovRoute(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (this *TagValueStrList) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TagValueStrList{`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `}`, + }, "") + return s +} +func (this *TagItemCondition) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TagItemCondition{`, + `ValueStr:` + fmt.Sprintf("%v", this.ValueStr) + `,`, + `ValueList:` + strings.Replace(fmt.Sprintf("%v", this.ValueList), "TagValueStrList", "TagValueStrList", 1) + `,`, + `Divisor:` + fmt.Sprintf("%v", this.Divisor) + `,`, + `Remainder:` + fmt.Sprintf("%v", this.Remainder) + `,`, + `Operator:` + fmt.Sprintf("%v", this.Operator) + `,`, + `}`, + }, "") + return s +} +func (this *TagItem) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TagItem{`, + `Location:` + fmt.Sprintf("%v", this.Location) + `,`, + `Key:` + fmt.Sprintf("%v", this.Key) + `,`, + `Condition:` + strings.Replace(fmt.Sprintf("%v", this.Condition), "TagItemCondition", "TagItemCondition", 1) + `,`, + `MatchType:` + fmt.Sprintf("%v", this.MatchType) + `,`, + `}`, + }, "") + return s +} +func (this *TagRule) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TagRule{`, + `Items:` + strings.Replace(fmt.Sprintf("%v", this.Items), "TagItem", "TagItem", 1) + `,`, + `}`, + }, "") + return s +} +func (this *TagRouter) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&TagRouter{`, + `ServiceName:` + fmt.Sprintf("%v", this.ServiceName) + `,`, + `Rules:` + strings.Replace(fmt.Sprintf("%v", this.Rules), "TagRule", "TagRule", 1) + `,`, + `}`, + }, "") + return s +} +func (this *PathRouter) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PathRouter{`, + `Prefix:` + fmt.Sprintf("%v", this.Prefix) + `,`, + `ServiceName:` + fmt.Sprintf("%v", this.ServiceName) + `,`, + `Tags:` + strings.Replace(fmt.Sprintf("%v", this.Tags), "TagRouter", "TagRouter", 1) + `,`, + `}`, + }, "") + return s +} +func (this *HostRouter) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&HostRouter{`, + `Host:` + fmt.Sprintf("%v", this.Host) + `,`, + `ServiceName:` + fmt.Sprintf("%v", this.ServiceName) + `,`, + `Paths:` + strings.Replace(fmt.Sprintf("%v", this.Paths), "PathRouter", "PathRouter", 1) + `,`, + `Tags:` + strings.Replace(fmt.Sprintf("%v", this.Tags), "TagRouter", "TagRouter", 1) + `,`, + `Type:` + fmt.Sprintf("%v", this.Type) + `,`, + `}`, + }, "") + return s +} +func (this *AppnameRouter) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&AppnameRouter{`, + `Appname:` + fmt.Sprintf("%v", this.Appname) + `,`, + `ServiceName:` + fmt.Sprintf("%v", this.ServiceName) + `,`, + `Tags:` + strings.Replace(fmt.Sprintf("%v", this.Tags), "TagRouter", "TagRouter", 1) + `,`, + `}`, + }, "") + return s +} +func (this *APIRouter) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&APIRouter{`, + `ServiceName:` + fmt.Sprintf("%v", this.ServiceName) + `,`, + `Api:` + fmt.Sprintf("%v", this.Api) + `,`, + `Tags:` + strings.Replace(fmt.Sprintf("%v", this.Tags), "TagRouter", "TagRouter", 1) + `,`, + `}`, + }, "") + return s +} +func (this *Router) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Router{`, + `HostRouter:` + strings.Replace(fmt.Sprintf("%v", this.HostRouter), "HostRouter", "HostRouter", 1) + `,`, + `AppnameRouter:` + strings.Replace(fmt.Sprintf("%v", this.AppnameRouter), "AppnameRouter", "AppnameRouter", 1) + `,`, + `ApiRouter:` + strings.Replace(fmt.Sprintf("%v", this.ApiRouter), "APIRouter", "APIRouter", 1) + `,`, + `}`, + }, "") + return s +} +func (this *Upstream) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Upstream{`, + `Target:` + fmt.Sprintf("%v", this.Target) + `,`, + `Weight:` + fmt.Sprintf("%v", this.Weight) + `,`, + `}`, + }, "") + return s +} +func (this *Timeout) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Timeout{`, + `ConnectTimeout:` + fmt.Sprintf("%v", this.ConnectTimeout) + `,`, + `ReadTimeout:` + fmt.Sprintf("%v", this.ReadTimeout) + `,`, + `WriteTimeout:` + fmt.Sprintf("%v", this.WriteTimeout) + `,`, + `}`, + }, "") + return s +} +func (this *Metadata) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Metadata{`, + `Key:` + fmt.Sprintf("%v", this.Key) + `,`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `}`, + }, "") + return s +} +func (this *Action) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Action{`, + `ActionType:` + fmt.Sprintf("%v", this.ActionType) + `,`, + `ValueType:` + fmt.Sprintf("%v", this.ValueType) + `,`, + `Key:` + fmt.Sprintf("%v", this.Key) + `,`, + `Value:` + fmt.Sprintf("%v", this.Value) + `,`, + `}`, + }, "") + return s +} +func (this *VirtualService) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&VirtualService{`, + `ServiceName:` + fmt.Sprintf("%v", this.ServiceName) + `,`, + `Upstreams:` + strings.Replace(fmt.Sprintf("%v", this.Upstreams), "Upstream", "Upstream", 1) + `,`, + `TimeoutMs:` + strings.Replace(fmt.Sprintf("%v", this.TimeoutMs), "Timeout", "Timeout", 1) + `,`, + `ForceHttps:` + fmt.Sprintf("%v", this.ForceHttps) + `,`, + `Metadata:` + strings.Replace(fmt.Sprintf("%v", this.Metadata), "Metadata", "Metadata", 1) + `,`, + `Action:` + strings.Replace(fmt.Sprintf("%v", this.Action), "Action", "Action", 1) + `,`, + `}`, + }, "") + return s +} +func (this *Config) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&Config{`, + `Routers:` + strings.Replace(fmt.Sprintf("%v", this.Routers), "Router", "Router", 1) + `,`, + `Services:` + strings.Replace(fmt.Sprintf("%v", this.Services), "VirtualService", "VirtualService", 1) + `,`, + `}`, + }, "") + return s +} +func valueToStringRoute(v interface{}) string { + rv := reflect.ValueOf(v) + if rv.IsNil() { + return "nil" + } + pv := reflect.Indirect(rv).Interface() + return fmt.Sprintf("*%v", pv) +} +func (m *TagValueStrList) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TagValueStrList: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TagValueStrList: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Value = append(m.Value, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TagItemCondition) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TagItemCondition: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TagItemCondition: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValueStr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValueStr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValueList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ValueList == nil { + m.ValueList = &TagValueStrList{} + } + if err := m.ValueList.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Divisor", wireType) + } + m.Divisor = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Divisor |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Remainder", wireType) + } + m.Remainder = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Remainder |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Operator", wireType) + } + m.Operator = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Operator |= OperatorType(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TagItem) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TagItem: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TagItem: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Location", wireType) + } + m.Location = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Location |= LocationType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Key = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Condition", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Condition == nil { + m.Condition = &TagItemCondition{} + } + if err := m.Condition.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MatchType", wireType) + } + m.MatchType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MatchType |= MatchType(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TagRule) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TagRule: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TagRule: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, &TagItem{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TagRouter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TagRouter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TagRouter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Rules", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Rules = append(m.Rules, &TagRule{}) + if err := m.Rules[len(m.Rules)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *PathRouter) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PathRouter: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PathRouter: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Prefix", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Prefix = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tags", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Tags = append(m.Tags, &TagRouter{}) + if err := m.Tags[len(m.Tags)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipRoute(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthRoute + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } } - s := strings.Join([]string{`&Config{`, - `Routers:` + strings.Replace(fmt.Sprintf("%v", this.Routers), "Router", "Router", 1) + `,`, - `Services:` + strings.Replace(fmt.Sprintf("%v", this.Services), "VirtualService", "VirtualService", 1) + `,`, - `}`, - }, "") - return s -} -func valueToStringRoute(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" + + if iNdEx > l { + return io.ErrUnexpectedEOF } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) + return nil } -func (m *TagItem) Unmarshal(dAtA []byte) error { +func (m *HostRouter) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2100,17 +4128,17 @@ func (m *TagItem) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TagItem: wiretype end group for non-group") + return fmt.Errorf("proto: HostRouter: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TagItem: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: HostRouter: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Location", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Host", wireType) } - m.Location = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRoute @@ -2120,14 +4148,27 @@ func (m *TagItem) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Location |= LocationType(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Host = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -2155,13 +4196,13 @@ func (m *TagItem) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Key = string(dAtA[iNdEx:postIndex]) + m.ServiceName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Paths", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRoute @@ -2171,29 +4212,65 @@ func (m *TagItem) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthRoute } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthRoute } if postIndex > l { return io.ErrUnexpectedEOF } - m.Value = string(dAtA[iNdEx:postIndex]) + m.Paths = append(m.Paths, &PathRouter{}) + if err := m.Paths[len(m.Paths)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tags", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Tags = append(m.Tags, &TagRouter{}) + if err := m.Tags[len(m.Tags)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MatchType", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) } - m.MatchType = 0 + m.Type = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRoute @@ -2203,7 +4280,7 @@ func (m *TagItem) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MatchType |= MatchType(b&0x7F) << shift + m.Type |= HostType(b&0x7F) << shift if b < 0x80 { break } @@ -2232,7 +4309,7 @@ func (m *TagItem) Unmarshal(dAtA []byte) error { } return nil } -func (m *TagRule) Unmarshal(dAtA []byte) error { +func (m *AppnameRouter) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2255,15 +4332,79 @@ func (m *TagRule) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TagRule: wiretype end group for non-group") + return fmt.Errorf("proto: AppnameRouter: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TagRule: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: AppnameRouter: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Appname", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Appname = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ServiceName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tags", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2290,8 +4431,8 @@ func (m *TagRule) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Items = append(m.Items, &TagItem{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Tags = append(m.Tags, &TagRouter{}) + if err := m.Tags[len(m.Tags)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2319,7 +4460,7 @@ func (m *TagRule) Unmarshal(dAtA []byte) error { } return nil } -func (m *TagRouter) Unmarshal(dAtA []byte) error { +func (m *APIRouter) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2342,10 +4483,10 @@ func (m *TagRouter) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TagRouter: wiretype end group for non-group") + return fmt.Errorf("proto: APIRouter: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TagRouter: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: APIRouter: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2382,7 +4523,39 @@ func (m *TagRouter) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Rules", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Api", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Api = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Tags", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2409,8 +4582,8 @@ func (m *TagRouter) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Rules = append(m.Rules, &TagRule{}) - if err := m.Rules[len(m.Rules)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Tags = append(m.Tags, &TagRouter{}) + if err := m.Tags[len(m.Tags)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2438,7 +4611,7 @@ func (m *TagRouter) Unmarshal(dAtA []byte) error { } return nil } -func (m *Timeout) Unmarshal(dAtA []byte) error { +func (m *Router) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2461,17 +4634,17 @@ func (m *Timeout) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Timeout: wiretype end group for non-group") + return fmt.Errorf("proto: Router: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Timeout: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Router: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ConnectTimeout", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HostRouter", wireType) } - m.ConnectTimeout = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRoute @@ -2481,16 +4654,33 @@ func (m *Timeout) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ConnectTimeout |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.HostRouter == nil { + m.HostRouter = &HostRouter{} + } + if err := m.HostRouter.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ReadTimeout", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AppnameRouter", wireType) } - m.ReadTimeout = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRoute @@ -2500,16 +4690,33 @@ func (m *Timeout) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ReadTimeout |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.AppnameRouter == nil { + m.AppnameRouter = &AppnameRouter{} + } + if err := m.AppnameRouter.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field WriteTimeout", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ApiRouter", wireType) } - m.WriteTimeout = 0 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRoute @@ -2519,11 +4726,28 @@ func (m *Timeout) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.WriteTimeout |= uint32(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } + if msglen < 0 { + return ErrInvalidLengthRoute + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthRoute + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.ApiRouter == nil { + m.ApiRouter = &APIRouter{} + } + if err := m.ApiRouter.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipRoute(dAtA[iNdEx:]) @@ -2652,7 +4876,7 @@ func (m *Upstream) Unmarshal(dAtA []byte) error { } return nil } -func (m *Metadata) Unmarshal(dAtA []byte) error { +func (m *Timeout) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2675,17 +4899,17 @@ func (m *Metadata) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Metadata: wiretype end group for non-group") + return fmt.Errorf("proto: Timeout: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Metadata: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Timeout: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ConnectTimeout", wireType) } - var stringLen uint64 + m.ConnectTimeout = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRoute @@ -2695,29 +4919,16 @@ func (m *Metadata) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ConnectTimeout |= uint32(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRoute - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRoute - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Key = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ReadTimeout", wireType) } - var stringLen uint64 + m.ReadTimeout = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRoute @@ -2727,24 +4938,30 @@ func (m *Metadata) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ReadTimeout |= uint32(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRoute - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRoute + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field WriteTimeout", wireType) } - if postIndex > l { - return io.ErrUnexpectedEOF + m.WriteTimeout = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.WriteTimeout |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } } - m.Value = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipRoute(dAtA[iNdEx:]) @@ -2769,8 +4986,7 @@ func (m *Metadata) Unmarshal(dAtA []byte) error { } return nil } -func (m *VirtualService) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 +func (m *Metadata) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2783,94 +4999,27 @@ func (m *VirtualService) Unmarshal(dAtA []byte) error { if iNdEx >= l { return io.ErrUnexpectedEOF } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VirtualService: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VirtualService: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRoute - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRoute - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRoute - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ServiceName = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Upstreams", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRoute - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthRoute - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthRoute - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Upstreams = append(m.Upstreams, &Upstream{}) - if err := m.Upstreams[len(m.Upstreams)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - iNdEx = postIndex - case 3: + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Metadata: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Metadata: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TimeoutMs", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRoute @@ -2880,53 +5029,29 @@ func (m *VirtualService) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthRoute } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthRoute } if postIndex > l { return io.ErrUnexpectedEOF } - if m.TimeoutMs == nil { - m.TimeoutMs = &Timeout{} - } - if err := m.TimeoutMs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Key = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ForceHttps", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRoute - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.ForceHttps = bool(v != 0) - case 5: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRoute @@ -2936,25 +5061,23 @@ func (m *VirtualService) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthRoute } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthRoute } if postIndex > l { return io.ErrUnexpectedEOF } - m.Metadata = append(m.Metadata, &Metadata{}) - if err := m.Metadata[len(m.Metadata)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Value = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2974,16 +5097,13 @@ func (m *VirtualService) Unmarshal(dAtA []byte) error { iNdEx += skippy } } - if hasFields[0]&uint64(0x00000001) == 0 { - return github_com_gogo_protobuf_proto.NewRequiredNotSetError("service_name") - } if iNdEx > l { return io.ErrUnexpectedEOF } return nil } -func (m *PathRouter) Unmarshal(dAtA []byte) error { +func (m *Action) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3006,17 +5126,17 @@ func (m *PathRouter) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: PathRouter: wiretype end group for non-group") + return fmt.Errorf("proto: Action: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: PathRouter: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Action: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Path", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ActionType", wireType) } - var stringLen uint64 + m.ActionType = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRoute @@ -3026,27 +5146,33 @@ func (m *PathRouter) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.ActionType |= ActionType(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthRoute - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthRoute + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValueType", wireType) } - if postIndex > l { - return io.ErrUnexpectedEOF + m.ValueType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ValueType |= ActionValueType(b&0x7F) << shift + if b < 0x80 { + break + } } - m.Path = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3074,13 +5200,13 @@ func (m *PathRouter) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ServiceName = string(dAtA[iNdEx:postIndex]) + m.Key = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tags", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Value", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRoute @@ -3090,25 +5216,23 @@ func (m *PathRouter) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthRoute } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthRoute } if postIndex > l { return io.ErrUnexpectedEOF } - m.Tags = append(m.Tags, &TagRouter{}) - if err := m.Tags[len(m.Tags)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Value = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3134,7 +5258,8 @@ func (m *PathRouter) Unmarshal(dAtA []byte) error { } return nil } -func (m *HostRouter) Unmarshal(dAtA []byte) error { +func (m *VirtualService) Unmarshal(dAtA []byte) error { + var hasFields [1]uint64 l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3157,15 +5282,15 @@ func (m *HostRouter) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: HostRouter: wiretype end group for non-group") + return fmt.Errorf("proto: VirtualService: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: HostRouter: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: VirtualService: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Host", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3193,13 +5318,14 @@ func (m *HostRouter) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Host = string(dAtA[iNdEx:postIndex]) + m.ServiceName = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + hasFields[0] |= uint64(0x00000001) case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ServiceName", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Upstreams", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowRoute @@ -3209,27 +5335,29 @@ func (m *HostRouter) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthRoute } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthRoute } if postIndex > l { return io.ErrUnexpectedEOF } - m.ServiceName = string(dAtA[iNdEx:postIndex]) + m.Upstreams = append(m.Upstreams, &Upstream{}) + if err := m.Upstreams[len(m.Upstreams)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Paths", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field TimeoutMs", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3256,14 +5384,36 @@ func (m *HostRouter) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Paths = append(m.Paths, &PathRouter{}) - if err := m.Paths[len(m.Paths)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if m.TimeoutMs == nil { + m.TimeoutMs = &Timeout{} + } + if err := m.TimeoutMs.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ForceHttps", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowRoute + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.ForceHttps = bool(v != 0) + case 5: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tags", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3290,67 +5440,14 @@ func (m *HostRouter) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Tags = append(m.Tags, &TagRouter{}) - if err := m.Tags[len(m.Tags)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Metadata = append(m.Metadata, &Metadata{}) + if err := m.Metadata[len(m.Metadata)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipRoute(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthRoute - } - if (iNdEx + skippy) < 0 { - return ErrInvalidLengthRoute - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Router) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowRoute - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Router: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Router: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 6: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field HostRouter", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Action", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3377,10 +5474,8 @@ func (m *Router) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.HostRouter == nil { - m.HostRouter = &HostRouter{} - } - if err := m.HostRouter.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.Action = append(m.Action, &Action{}) + if err := m.Action[len(m.Action)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3402,6 +5497,9 @@ func (m *Router) Unmarshal(dAtA []byte) error { iNdEx += skippy } } + if hasFields[0]&uint64(0x00000001) == 0 { + return github_com_gogo_protobuf_proto.NewRequiredNotSetError("service_name") + } if iNdEx > l { return io.ErrUnexpectedEOF diff --git a/internal/route/route.proto b/internal/route/route.proto index e61f52f9..5ccf8792 100644 --- a/internal/route/route.proto +++ b/internal/route/route.proto @@ -1,5 +1,5 @@ /* -Copyright 2022 The Alibaba Authors. +Copyright 2022-2023 The Alibaba Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -19,40 +19,94 @@ option go_package = "./;route"; package route; +message TagValueStrList { + repeated string value = 1; // a list of strings +} + +enum OperatorType { + OperatorUnDefined = 0; + OperatorEqual = 1; // equal + OperatorGreater = 2; // greater than + OperatorLess = 3; // less than + OperatorGreaterEqual = 4; // greater than or equal + OperatorLessEqual = 5; // less than or equal +} + enum LocationType { - LocHttpHeader = 0; - LocHttpQuery = 1; - LocNginxVar = 2; - LocXBizInfo = 3; + LocUnDefined = 0; + LocHttpHeader = 1; // HTTP header + LocHttpQuery = 2; // HTTP query + LocNginxVar = 3; // Nginx var + LocXBizInfo = 4; // x-biz-info + LocHttpCookie = 5; // HTTP cookie +} + +message TagItemCondition { + optional string value_str = 1; // an exact string + optional TagValueStrList value_list = 2; // a list of strings + optional uint64 divisor = 3; // mode divisor for modulo operation + optional uint64 remainder = 4; // compare remainder for modulo operation + optional OperatorType operator = 5; // >, <, =, >=, <= for modulo operation } enum MatchType { - WholeMatch = 0; - PrefixMatch = 1; - SuffixMatch = 2; - RegMatch = 3; + MatchUnDefined = 0; + WholeMatch = 1; // match an exact string + StrListInMatch = 2; // match a string with a list of strings + ModCompare = 3; // match the result of modulo operation } message TagItem { - optional LocationType location = 1; - optional string key = 2; - optional string value = 3; - optional MatchType match_type =4; + optional LocationType location = 1; // location type + optional string key = 2; // the key to be parsed + optional TagItemCondition condition = 3; // the value to be parsed + optional MatchType match_type = 4; // match type } message TagRule { - repeated TagItem items = 1; + repeated TagItem items = 1; // AND } message TagRouter { optional string service_name = 1; - repeated TagRule rules = 2; + repeated TagRule rules = 2; // OR } -message Timeout { - optional uint32 connect_timeout = 1; - optional uint32 read_timeout = 2; - optional uint32 write_timeout = 3; +message PathRouter { + optional string prefix = 1; + optional string service_name = 2; + repeated TagRouter tags = 3; +} + +enum HostType { + Web = 0; // web + MTOP = 1; // mtop +} + +message HostRouter { + optional string host = 1; + optional string service_name = 2; + repeated PathRouter paths = 3; + repeated TagRouter tags = 4; + optional HostType type = 5; +} + +message AppnameRouter { + optional string appname = 1; + optional string service_name = 2; + repeated TagRouter tags = 3; +} + +message APIRouter { + optional string service_name = 1; + optional string api = 2; + repeated TagRouter tags = 3; +} + +message Router { + optional HostRouter host_router = 1; + optional AppnameRouter appname_router = 2; + optional APIRouter api_router = 3; } message Upstream { @@ -60,38 +114,49 @@ message Upstream { optional uint32 weight = 2; } -message Metadata -{ - optional string key = 1; - optional string value = 2; +message Timeout { + optional uint32 connect_timeout = 1; + optional uint32 read_timeout = 2; + optional uint32 write_timeout = 3; } -message VirtualService { - required string service_name = 1; - repeated Upstream upstreams = 2; - optional Timeout timeout_ms = 3; - optional bool force_https = 4; - repeated Metadata metadata = 5; +message Metadata { + optional string key = 1; + optional string value = 2; } -message PathRouter { - optional string path = 1; - optional string service_name = 2; - repeated TagRouter tags = 3; +enum ActionType { + ActionUnDefined = 0; + ActionAddReqHeader = 1; // Add header to request, if the header is present on the request, the header and value will be added to the request again. + ActionAppendReqHeader = 2; // Append header value to request header, if the header is not present on the request, the header will be added to the request. + ActionAddRespHeader = 3; // Add header to response, if the header is present on the request, the header and value will be added to the response again. + ActionAppendRespHeader = 4; // Append header value to response header, if the header is not present on the request, the header will be added to the response. + ActionAddParam = 5; // Add query to request, if the query is present on the request, the query and value will be added to the request again. } -message HostRouter { - optional string host = 1; - optional string service_name = 2; - repeated PathRouter paths = 3; - repeated TagRouter tags = 4; +enum ActionValueType { + ActionValueUnDefined = 0; + ActionStaticValue = 1; // get value from static config + ActionDynamicValue = 2; // get value from Nginx var } -message Router { - optional HostRouter host_router = 1; +message Action { + optional ActionType action_type = 1; + optional ActionValueType value_type = 2; + optional string key = 3; + optional string value = 4; +} + +message VirtualService { + required string service_name = 1; + repeated Upstream upstreams = 2; + optional Timeout timeout_ms = 3; + optional bool force_https = 4; + repeated Metadata metadata = 5; + repeated Action action = 6; } message Config { - repeated Router routers = 1; + repeated Router routers = 1; repeated VirtualService services = 2; }