github.com/weaveworks/common@v0.0.0-20230728070032-dd9e68f319d5/httpgrpc/httpgrpc.pb.go (about) 1 // Code generated by protoc-gen-gogo. DO NOT EDIT. 2 // source: httpgrpc/httpgrpc.proto 3 4 package httpgrpc 5 6 import ( 7 bytes "bytes" 8 context "context" 9 fmt "fmt" 10 _ "github.com/gogo/protobuf/gogoproto" 11 proto "github.com/gogo/protobuf/proto" 12 grpc "google.golang.org/grpc" 13 codes "google.golang.org/grpc/codes" 14 status "google.golang.org/grpc/status" 15 io "io" 16 math "math" 17 math_bits "math/bits" 18 reflect "reflect" 19 strings "strings" 20 ) 21 22 // Reference imports to suppress errors if they are not otherwise used. 23 var _ = proto.Marshal 24 var _ = fmt.Errorf 25 var _ = math.Inf 26 27 // This is a compile-time assertion to ensure that this generated file 28 // is compatible with the proto package it is being compiled against. 29 // A compilation error at this line likely means your copy of the 30 // proto package needs to be updated. 31 const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package 32 33 type HTTPRequest struct { 34 Method string `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"` 35 Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` 36 Headers []*Header `protobuf:"bytes,3,rep,name=headers,proto3" json:"headers,omitempty"` 37 Body []byte `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"` 38 } 39 40 func (m *HTTPRequest) Reset() { *m = HTTPRequest{} } 41 func (*HTTPRequest) ProtoMessage() {} 42 func (*HTTPRequest) Descriptor() ([]byte, []int) { 43 return fileDescriptor_6670c8e151665986, []int{0} 44 } 45 func (m *HTTPRequest) XXX_Unmarshal(b []byte) error { 46 return m.Unmarshal(b) 47 } 48 func (m *HTTPRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 49 if deterministic { 50 return xxx_messageInfo_HTTPRequest.Marshal(b, m, deterministic) 51 } else { 52 b = b[:cap(b)] 53 n, err := m.MarshalToSizedBuffer(b) 54 if err != nil { 55 return nil, err 56 } 57 return b[:n], nil 58 } 59 } 60 func (m *HTTPRequest) XXX_Merge(src proto.Message) { 61 xxx_messageInfo_HTTPRequest.Merge(m, src) 62 } 63 func (m *HTTPRequest) XXX_Size() int { 64 return m.Size() 65 } 66 func (m *HTTPRequest) XXX_DiscardUnknown() { 67 xxx_messageInfo_HTTPRequest.DiscardUnknown(m) 68 } 69 70 var xxx_messageInfo_HTTPRequest proto.InternalMessageInfo 71 72 func (m *HTTPRequest) GetMethod() string { 73 if m != nil { 74 return m.Method 75 } 76 return "" 77 } 78 79 func (m *HTTPRequest) GetUrl() string { 80 if m != nil { 81 return m.Url 82 } 83 return "" 84 } 85 86 func (m *HTTPRequest) GetHeaders() []*Header { 87 if m != nil { 88 return m.Headers 89 } 90 return nil 91 } 92 93 func (m *HTTPRequest) GetBody() []byte { 94 if m != nil { 95 return m.Body 96 } 97 return nil 98 } 99 100 type HTTPResponse struct { 101 Code int32 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"` 102 Headers []*Header `protobuf:"bytes,2,rep,name=headers,proto3" json:"headers,omitempty"` 103 Body []byte `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"` 104 } 105 106 func (m *HTTPResponse) Reset() { *m = HTTPResponse{} } 107 func (*HTTPResponse) ProtoMessage() {} 108 func (*HTTPResponse) Descriptor() ([]byte, []int) { 109 return fileDescriptor_6670c8e151665986, []int{1} 110 } 111 func (m *HTTPResponse) XXX_Unmarshal(b []byte) error { 112 return m.Unmarshal(b) 113 } 114 func (m *HTTPResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 115 if deterministic { 116 return xxx_messageInfo_HTTPResponse.Marshal(b, m, deterministic) 117 } else { 118 b = b[:cap(b)] 119 n, err := m.MarshalToSizedBuffer(b) 120 if err != nil { 121 return nil, err 122 } 123 return b[:n], nil 124 } 125 } 126 func (m *HTTPResponse) XXX_Merge(src proto.Message) { 127 xxx_messageInfo_HTTPResponse.Merge(m, src) 128 } 129 func (m *HTTPResponse) XXX_Size() int { 130 return m.Size() 131 } 132 func (m *HTTPResponse) XXX_DiscardUnknown() { 133 xxx_messageInfo_HTTPResponse.DiscardUnknown(m) 134 } 135 136 var xxx_messageInfo_HTTPResponse proto.InternalMessageInfo 137 138 func (m *HTTPResponse) GetCode() int32 { 139 if m != nil { 140 return m.Code 141 } 142 return 0 143 } 144 145 func (m *HTTPResponse) GetHeaders() []*Header { 146 if m != nil { 147 return m.Headers 148 } 149 return nil 150 } 151 152 func (m *HTTPResponse) GetBody() []byte { 153 if m != nil { 154 return m.Body 155 } 156 return nil 157 } 158 159 type Header struct { 160 Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` 161 Values []string `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` 162 } 163 164 func (m *Header) Reset() { *m = Header{} } 165 func (*Header) ProtoMessage() {} 166 func (*Header) Descriptor() ([]byte, []int) { 167 return fileDescriptor_6670c8e151665986, []int{2} 168 } 169 func (m *Header) XXX_Unmarshal(b []byte) error { 170 return m.Unmarshal(b) 171 } 172 func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { 173 if deterministic { 174 return xxx_messageInfo_Header.Marshal(b, m, deterministic) 175 } else { 176 b = b[:cap(b)] 177 n, err := m.MarshalToSizedBuffer(b) 178 if err != nil { 179 return nil, err 180 } 181 return b[:n], nil 182 } 183 } 184 func (m *Header) XXX_Merge(src proto.Message) { 185 xxx_messageInfo_Header.Merge(m, src) 186 } 187 func (m *Header) XXX_Size() int { 188 return m.Size() 189 } 190 func (m *Header) XXX_DiscardUnknown() { 191 xxx_messageInfo_Header.DiscardUnknown(m) 192 } 193 194 var xxx_messageInfo_Header proto.InternalMessageInfo 195 196 func (m *Header) GetKey() string { 197 if m != nil { 198 return m.Key 199 } 200 return "" 201 } 202 203 func (m *Header) GetValues() []string { 204 if m != nil { 205 return m.Values 206 } 207 return nil 208 } 209 210 func init() { 211 proto.RegisterType((*HTTPRequest)(nil), "httpgrpc.HTTPRequest") 212 proto.RegisterType((*HTTPResponse)(nil), "httpgrpc.HTTPResponse") 213 proto.RegisterType((*Header)(nil), "httpgrpc.Header") 214 } 215 216 func init() { proto.RegisterFile("httpgrpc/httpgrpc.proto", fileDescriptor_6670c8e151665986) } 217 218 var fileDescriptor_6670c8e151665986 = []byte{ 219 // 322 bytes of a gzipped FileDescriptorProto 220 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0x3f, 0x4f, 0xc2, 0x40, 221 0x14, 0xc0, 0x7b, 0x14, 0xab, 0x1c, 0x0c, 0xe4, 0xa2, 0xd8, 0x30, 0x5c, 0x08, 0x89, 0x09, 0x71, 222 0xa0, 0x09, 0x4e, 0x8e, 0xea, 0xc2, 0xa6, 0xb9, 0x30, 0xb9, 0xb5, 0xf4, 0xa5, 0x35, 0x50, 0x5e, 223 0x6d, 0xaf, 0x10, 0x36, 0x3f, 0x82, 0x1f, 0xc3, 0x8f, 0xe2, 0xc8, 0xc8, 0x28, 0xe5, 0x0b, 0xf8, 224 0x11, 0xcc, 0x5d, 0x29, 0x36, 0x4e, 0x6e, 0xbf, 0xf7, 0x27, 0xf7, 0x7b, 0xef, 0x1e, 0xbd, 0x0c, 225 0xa5, 0x8c, 0x83, 0x24, 0x9e, 0x3a, 0x25, 0x0c, 0xe3, 0x04, 0x25, 0xb2, 0xb3, 0x32, 0xee, 0x9e, 226 0x07, 0x18, 0xa0, 0x4e, 0x3a, 0x8a, 0x8a, 0x7a, 0x7f, 0x45, 0x9b, 0xe3, 0xc9, 0xe4, 0x49, 0xc0, 227 0x6b, 0x06, 0xa9, 0x64, 0x1d, 0x6a, 0x45, 0x20, 0x43, 0xf4, 0x6d, 0xd2, 0x23, 0x83, 0x86, 0x38, 228 0x44, 0xac, 0x4d, 0xcd, 0x2c, 0x99, 0xdb, 0x35, 0x9d, 0x54, 0xc8, 0xae, 0xe9, 0x69, 0x08, 0xae, 229 0x0f, 0x49, 0x6a, 0x9b, 0x3d, 0x73, 0xd0, 0x1c, 0xb5, 0x87, 0x47, 0xf5, 0x58, 0x17, 0x44, 0xd9, 230 0xc0, 0x18, 0xad, 0x7b, 0xe8, 0xaf, 0xed, 0x7a, 0x8f, 0x0c, 0x5a, 0x42, 0x73, 0xdf, 0xa3, 0xad, 231 0x42, 0x9c, 0xc6, 0xb8, 0x48, 0x41, 0xf5, 0x3c, 0xa0, 0x0f, 0xda, 0x7b, 0x22, 0x34, 0x57, 0x1d, 232 0xb5, 0xff, 0x3a, 0xcc, 0x8a, 0x63, 0x44, 0xad, 0xa2, 0x4d, 0xcd, 0x3f, 0x83, 0xf5, 0x61, 0x29, 233 0x85, 0x6a, 0xd3, 0xa5, 0x3b, 0xcf, 0xa0, 0x78, 0xba, 0x21, 0x0e, 0xd1, 0xe8, 0x8e, 0xd6, 0xd5, 234 0x5c, 0xec, 0x96, 0x5a, 0x63, 0x77, 0xe1, 0xcf, 0x81, 0x5d, 0x54, 0xa4, 0xbf, 0x5f, 0xd5, 0xed, 235 0xfc, 0x4d, 0x17, 0x8b, 0xf4, 0x8d, 0xfb, 0xc7, 0xed, 0x8e, 0x1b, 0xdf, 0x3b, 0x4e, 0xde, 0x72, 236 0x4e, 0x3e, 0x72, 0x4e, 0x3e, 0x73, 0x4e, 0x36, 0x39, 0x27, 0x5f, 0x39, 0x27, 0xef, 0x7b, 0x6e, 237 0x6c, 0xf6, 0xdc, 0xd8, 0xee, 0xb9, 0xf1, 0x7c, 0x15, 0xbc, 0xc8, 0x30, 0xf3, 0x86, 0x53, 0x8c, 238 0x9c, 0x15, 0xb8, 0x4b, 0x58, 0x61, 0x32, 0x4b, 0x9d, 0x29, 0x46, 0x11, 0x2e, 0x8e, 0xa7, 0xf4, 239 0x2c, 0x7d, 0xab, 0x9b, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd8, 0xb5, 0xfe, 0x5d, 0xe6, 0x01, 240 0x00, 0x00, 241 } 242 243 func (this *HTTPRequest) Equal(that interface{}) bool { 244 if that == nil { 245 return this == nil 246 } 247 248 that1, ok := that.(*HTTPRequest) 249 if !ok { 250 that2, ok := that.(HTTPRequest) 251 if ok { 252 that1 = &that2 253 } else { 254 return false 255 } 256 } 257 if that1 == nil { 258 return this == nil 259 } else if this == nil { 260 return false 261 } 262 if this.Method != that1.Method { 263 return false 264 } 265 if this.Url != that1.Url { 266 return false 267 } 268 if len(this.Headers) != len(that1.Headers) { 269 return false 270 } 271 for i := range this.Headers { 272 if !this.Headers[i].Equal(that1.Headers[i]) { 273 return false 274 } 275 } 276 if !bytes.Equal(this.Body, that1.Body) { 277 return false 278 } 279 return true 280 } 281 func (this *HTTPResponse) Equal(that interface{}) bool { 282 if that == nil { 283 return this == nil 284 } 285 286 that1, ok := that.(*HTTPResponse) 287 if !ok { 288 that2, ok := that.(HTTPResponse) 289 if ok { 290 that1 = &that2 291 } else { 292 return false 293 } 294 } 295 if that1 == nil { 296 return this == nil 297 } else if this == nil { 298 return false 299 } 300 if this.Code != that1.Code { 301 return false 302 } 303 if len(this.Headers) != len(that1.Headers) { 304 return false 305 } 306 for i := range this.Headers { 307 if !this.Headers[i].Equal(that1.Headers[i]) { 308 return false 309 } 310 } 311 if !bytes.Equal(this.Body, that1.Body) { 312 return false 313 } 314 return true 315 } 316 func (this *Header) Equal(that interface{}) bool { 317 if that == nil { 318 return this == nil 319 } 320 321 that1, ok := that.(*Header) 322 if !ok { 323 that2, ok := that.(Header) 324 if ok { 325 that1 = &that2 326 } else { 327 return false 328 } 329 } 330 if that1 == nil { 331 return this == nil 332 } else if this == nil { 333 return false 334 } 335 if this.Key != that1.Key { 336 return false 337 } 338 if len(this.Values) != len(that1.Values) { 339 return false 340 } 341 for i := range this.Values { 342 if this.Values[i] != that1.Values[i] { 343 return false 344 } 345 } 346 return true 347 } 348 func (this *HTTPRequest) GoString() string { 349 if this == nil { 350 return "nil" 351 } 352 s := make([]string, 0, 8) 353 s = append(s, "&httpgrpc.HTTPRequest{") 354 s = append(s, "Method: "+fmt.Sprintf("%#v", this.Method)+",\n") 355 s = append(s, "Url: "+fmt.Sprintf("%#v", this.Url)+",\n") 356 if this.Headers != nil { 357 s = append(s, "Headers: "+fmt.Sprintf("%#v", this.Headers)+",\n") 358 } 359 s = append(s, "Body: "+fmt.Sprintf("%#v", this.Body)+",\n") 360 s = append(s, "}") 361 return strings.Join(s, "") 362 } 363 func (this *HTTPResponse) GoString() string { 364 if this == nil { 365 return "nil" 366 } 367 s := make([]string, 0, 7) 368 s = append(s, "&httpgrpc.HTTPResponse{") 369 s = append(s, "Code: "+fmt.Sprintf("%#v", this.Code)+",\n") 370 if this.Headers != nil { 371 s = append(s, "Headers: "+fmt.Sprintf("%#v", this.Headers)+",\n") 372 } 373 s = append(s, "Body: "+fmt.Sprintf("%#v", this.Body)+",\n") 374 s = append(s, "}") 375 return strings.Join(s, "") 376 } 377 func (this *Header) GoString() string { 378 if this == nil { 379 return "nil" 380 } 381 s := make([]string, 0, 6) 382 s = append(s, "&httpgrpc.Header{") 383 s = append(s, "Key: "+fmt.Sprintf("%#v", this.Key)+",\n") 384 s = append(s, "Values: "+fmt.Sprintf("%#v", this.Values)+",\n") 385 s = append(s, "}") 386 return strings.Join(s, "") 387 } 388 func valueToGoStringHttpgrpc(v interface{}, typ string) string { 389 rv := reflect.ValueOf(v) 390 if rv.IsNil() { 391 return "nil" 392 } 393 pv := reflect.Indirect(rv).Interface() 394 return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) 395 } 396 397 // Reference imports to suppress errors if they are not otherwise used. 398 var _ context.Context 399 var _ grpc.ClientConn 400 401 // This is a compile-time assertion to ensure that this generated file 402 // is compatible with the grpc package it is being compiled against. 403 const _ = grpc.SupportPackageIsVersion4 404 405 // HTTPClient is the client API for HTTP service. 406 // 407 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. 408 type HTTPClient interface { 409 Handle(ctx context.Context, in *HTTPRequest, opts ...grpc.CallOption) (*HTTPResponse, error) 410 } 411 412 type hTTPClient struct { 413 cc *grpc.ClientConn 414 } 415 416 func NewHTTPClient(cc *grpc.ClientConn) HTTPClient { 417 return &hTTPClient{cc} 418 } 419 420 func (c *hTTPClient) Handle(ctx context.Context, in *HTTPRequest, opts ...grpc.CallOption) (*HTTPResponse, error) { 421 out := new(HTTPResponse) 422 err := c.cc.Invoke(ctx, "/httpgrpc.HTTP/Handle", in, out, opts...) 423 if err != nil { 424 return nil, err 425 } 426 return out, nil 427 } 428 429 // HTTPServer is the server API for HTTP service. 430 type HTTPServer interface { 431 Handle(context.Context, *HTTPRequest) (*HTTPResponse, error) 432 } 433 434 // UnimplementedHTTPServer can be embedded to have forward compatible implementations. 435 type UnimplementedHTTPServer struct { 436 } 437 438 func (*UnimplementedHTTPServer) Handle(ctx context.Context, req *HTTPRequest) (*HTTPResponse, error) { 439 return nil, status.Errorf(codes.Unimplemented, "method Handle not implemented") 440 } 441 442 func RegisterHTTPServer(s *grpc.Server, srv HTTPServer) { 443 s.RegisterService(&_HTTP_serviceDesc, srv) 444 } 445 446 func _HTTP_Handle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 447 in := new(HTTPRequest) 448 if err := dec(in); err != nil { 449 return nil, err 450 } 451 if interceptor == nil { 452 return srv.(HTTPServer).Handle(ctx, in) 453 } 454 info := &grpc.UnaryServerInfo{ 455 Server: srv, 456 FullMethod: "/httpgrpc.HTTP/Handle", 457 } 458 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 459 return srv.(HTTPServer).Handle(ctx, req.(*HTTPRequest)) 460 } 461 return interceptor(ctx, in, info, handler) 462 } 463 464 var _HTTP_serviceDesc = grpc.ServiceDesc{ 465 ServiceName: "httpgrpc.HTTP", 466 HandlerType: (*HTTPServer)(nil), 467 Methods: []grpc.MethodDesc{ 468 { 469 MethodName: "Handle", 470 Handler: _HTTP_Handle_Handler, 471 }, 472 }, 473 Streams: []grpc.StreamDesc{}, 474 Metadata: "httpgrpc/httpgrpc.proto", 475 } 476 477 func (m *HTTPRequest) Marshal() (dAtA []byte, err error) { 478 size := m.Size() 479 dAtA = make([]byte, size) 480 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 481 if err != nil { 482 return nil, err 483 } 484 return dAtA[:n], nil 485 } 486 487 func (m *HTTPRequest) MarshalTo(dAtA []byte) (int, error) { 488 size := m.Size() 489 return m.MarshalToSizedBuffer(dAtA[:size]) 490 } 491 492 func (m *HTTPRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { 493 i := len(dAtA) 494 _ = i 495 var l int 496 _ = l 497 if len(m.Body) > 0 { 498 i -= len(m.Body) 499 copy(dAtA[i:], m.Body) 500 i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Body))) 501 i-- 502 dAtA[i] = 0x22 503 } 504 if len(m.Headers) > 0 { 505 for iNdEx := len(m.Headers) - 1; iNdEx >= 0; iNdEx-- { 506 { 507 size, err := m.Headers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) 508 if err != nil { 509 return 0, err 510 } 511 i -= size 512 i = encodeVarintHttpgrpc(dAtA, i, uint64(size)) 513 } 514 i-- 515 dAtA[i] = 0x1a 516 } 517 } 518 if len(m.Url) > 0 { 519 i -= len(m.Url) 520 copy(dAtA[i:], m.Url) 521 i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Url))) 522 i-- 523 dAtA[i] = 0x12 524 } 525 if len(m.Method) > 0 { 526 i -= len(m.Method) 527 copy(dAtA[i:], m.Method) 528 i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Method))) 529 i-- 530 dAtA[i] = 0xa 531 } 532 return len(dAtA) - i, nil 533 } 534 535 func (m *HTTPResponse) Marshal() (dAtA []byte, err error) { 536 size := m.Size() 537 dAtA = make([]byte, size) 538 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 539 if err != nil { 540 return nil, err 541 } 542 return dAtA[:n], nil 543 } 544 545 func (m *HTTPResponse) MarshalTo(dAtA []byte) (int, error) { 546 size := m.Size() 547 return m.MarshalToSizedBuffer(dAtA[:size]) 548 } 549 550 func (m *HTTPResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { 551 i := len(dAtA) 552 _ = i 553 var l int 554 _ = l 555 if len(m.Body) > 0 { 556 i -= len(m.Body) 557 copy(dAtA[i:], m.Body) 558 i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Body))) 559 i-- 560 dAtA[i] = 0x1a 561 } 562 if len(m.Headers) > 0 { 563 for iNdEx := len(m.Headers) - 1; iNdEx >= 0; iNdEx-- { 564 { 565 size, err := m.Headers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) 566 if err != nil { 567 return 0, err 568 } 569 i -= size 570 i = encodeVarintHttpgrpc(dAtA, i, uint64(size)) 571 } 572 i-- 573 dAtA[i] = 0x12 574 } 575 } 576 if m.Code != 0 { 577 i = encodeVarintHttpgrpc(dAtA, i, uint64(m.Code)) 578 i-- 579 dAtA[i] = 0x8 580 } 581 return len(dAtA) - i, nil 582 } 583 584 func (m *Header) Marshal() (dAtA []byte, err error) { 585 size := m.Size() 586 dAtA = make([]byte, size) 587 n, err := m.MarshalToSizedBuffer(dAtA[:size]) 588 if err != nil { 589 return nil, err 590 } 591 return dAtA[:n], nil 592 } 593 594 func (m *Header) MarshalTo(dAtA []byte) (int, error) { 595 size := m.Size() 596 return m.MarshalToSizedBuffer(dAtA[:size]) 597 } 598 599 func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { 600 i := len(dAtA) 601 _ = i 602 var l int 603 _ = l 604 if len(m.Values) > 0 { 605 for iNdEx := len(m.Values) - 1; iNdEx >= 0; iNdEx-- { 606 i -= len(m.Values[iNdEx]) 607 copy(dAtA[i:], m.Values[iNdEx]) 608 i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Values[iNdEx]))) 609 i-- 610 dAtA[i] = 0x12 611 } 612 } 613 if len(m.Key) > 0 { 614 i -= len(m.Key) 615 copy(dAtA[i:], m.Key) 616 i = encodeVarintHttpgrpc(dAtA, i, uint64(len(m.Key))) 617 i-- 618 dAtA[i] = 0xa 619 } 620 return len(dAtA) - i, nil 621 } 622 623 func encodeVarintHttpgrpc(dAtA []byte, offset int, v uint64) int { 624 offset -= sovHttpgrpc(v) 625 base := offset 626 for v >= 1<<7 { 627 dAtA[offset] = uint8(v&0x7f | 0x80) 628 v >>= 7 629 offset++ 630 } 631 dAtA[offset] = uint8(v) 632 return base 633 } 634 func (m *HTTPRequest) Size() (n int) { 635 if m == nil { 636 return 0 637 } 638 var l int 639 _ = l 640 l = len(m.Method) 641 if l > 0 { 642 n += 1 + l + sovHttpgrpc(uint64(l)) 643 } 644 l = len(m.Url) 645 if l > 0 { 646 n += 1 + l + sovHttpgrpc(uint64(l)) 647 } 648 if len(m.Headers) > 0 { 649 for _, e := range m.Headers { 650 l = e.Size() 651 n += 1 + l + sovHttpgrpc(uint64(l)) 652 } 653 } 654 l = len(m.Body) 655 if l > 0 { 656 n += 1 + l + sovHttpgrpc(uint64(l)) 657 } 658 return n 659 } 660 661 func (m *HTTPResponse) Size() (n int) { 662 if m == nil { 663 return 0 664 } 665 var l int 666 _ = l 667 if m.Code != 0 { 668 n += 1 + sovHttpgrpc(uint64(m.Code)) 669 } 670 if len(m.Headers) > 0 { 671 for _, e := range m.Headers { 672 l = e.Size() 673 n += 1 + l + sovHttpgrpc(uint64(l)) 674 } 675 } 676 l = len(m.Body) 677 if l > 0 { 678 n += 1 + l + sovHttpgrpc(uint64(l)) 679 } 680 return n 681 } 682 683 func (m *Header) Size() (n int) { 684 if m == nil { 685 return 0 686 } 687 var l int 688 _ = l 689 l = len(m.Key) 690 if l > 0 { 691 n += 1 + l + sovHttpgrpc(uint64(l)) 692 } 693 if len(m.Values) > 0 { 694 for _, s := range m.Values { 695 l = len(s) 696 n += 1 + l + sovHttpgrpc(uint64(l)) 697 } 698 } 699 return n 700 } 701 702 func sovHttpgrpc(x uint64) (n int) { 703 return (math_bits.Len64(x|1) + 6) / 7 704 } 705 func sozHttpgrpc(x uint64) (n int) { 706 return sovHttpgrpc(uint64((x << 1) ^ uint64((int64(x) >> 63)))) 707 } 708 func (this *HTTPRequest) String() string { 709 if this == nil { 710 return "nil" 711 } 712 repeatedStringForHeaders := "[]*Header{" 713 for _, f := range this.Headers { 714 repeatedStringForHeaders += strings.Replace(f.String(), "Header", "Header", 1) + "," 715 } 716 repeatedStringForHeaders += "}" 717 s := strings.Join([]string{`&HTTPRequest{`, 718 `Method:` + fmt.Sprintf("%v", this.Method) + `,`, 719 `Url:` + fmt.Sprintf("%v", this.Url) + `,`, 720 `Headers:` + repeatedStringForHeaders + `,`, 721 `Body:` + fmt.Sprintf("%v", this.Body) + `,`, 722 `}`, 723 }, "") 724 return s 725 } 726 func (this *HTTPResponse) String() string { 727 if this == nil { 728 return "nil" 729 } 730 repeatedStringForHeaders := "[]*Header{" 731 for _, f := range this.Headers { 732 repeatedStringForHeaders += strings.Replace(f.String(), "Header", "Header", 1) + "," 733 } 734 repeatedStringForHeaders += "}" 735 s := strings.Join([]string{`&HTTPResponse{`, 736 `Code:` + fmt.Sprintf("%v", this.Code) + `,`, 737 `Headers:` + repeatedStringForHeaders + `,`, 738 `Body:` + fmt.Sprintf("%v", this.Body) + `,`, 739 `}`, 740 }, "") 741 return s 742 } 743 func (this *Header) String() string { 744 if this == nil { 745 return "nil" 746 } 747 s := strings.Join([]string{`&Header{`, 748 `Key:` + fmt.Sprintf("%v", this.Key) + `,`, 749 `Values:` + fmt.Sprintf("%v", this.Values) + `,`, 750 `}`, 751 }, "") 752 return s 753 } 754 func valueToStringHttpgrpc(v interface{}) string { 755 rv := reflect.ValueOf(v) 756 if rv.IsNil() { 757 return "nil" 758 } 759 pv := reflect.Indirect(rv).Interface() 760 return fmt.Sprintf("*%v", pv) 761 } 762 func (m *HTTPRequest) Unmarshal(dAtA []byte) error { 763 l := len(dAtA) 764 iNdEx := 0 765 for iNdEx < l { 766 preIndex := iNdEx 767 var wire uint64 768 for shift := uint(0); ; shift += 7 { 769 if shift >= 64 { 770 return ErrIntOverflowHttpgrpc 771 } 772 if iNdEx >= l { 773 return io.ErrUnexpectedEOF 774 } 775 b := dAtA[iNdEx] 776 iNdEx++ 777 wire |= uint64(b&0x7F) << shift 778 if b < 0x80 { 779 break 780 } 781 } 782 fieldNum := int32(wire >> 3) 783 wireType := int(wire & 0x7) 784 if wireType == 4 { 785 return fmt.Errorf("proto: HTTPRequest: wiretype end group for non-group") 786 } 787 if fieldNum <= 0 { 788 return fmt.Errorf("proto: HTTPRequest: illegal tag %d (wire type %d)", fieldNum, wire) 789 } 790 switch fieldNum { 791 case 1: 792 if wireType != 2 { 793 return fmt.Errorf("proto: wrong wireType = %d for field Method", wireType) 794 } 795 var stringLen uint64 796 for shift := uint(0); ; shift += 7 { 797 if shift >= 64 { 798 return ErrIntOverflowHttpgrpc 799 } 800 if iNdEx >= l { 801 return io.ErrUnexpectedEOF 802 } 803 b := dAtA[iNdEx] 804 iNdEx++ 805 stringLen |= uint64(b&0x7F) << shift 806 if b < 0x80 { 807 break 808 } 809 } 810 intStringLen := int(stringLen) 811 if intStringLen < 0 { 812 return ErrInvalidLengthHttpgrpc 813 } 814 postIndex := iNdEx + intStringLen 815 if postIndex < 0 { 816 return ErrInvalidLengthHttpgrpc 817 } 818 if postIndex > l { 819 return io.ErrUnexpectedEOF 820 } 821 m.Method = string(dAtA[iNdEx:postIndex]) 822 iNdEx = postIndex 823 case 2: 824 if wireType != 2 { 825 return fmt.Errorf("proto: wrong wireType = %d for field Url", wireType) 826 } 827 var stringLen uint64 828 for shift := uint(0); ; shift += 7 { 829 if shift >= 64 { 830 return ErrIntOverflowHttpgrpc 831 } 832 if iNdEx >= l { 833 return io.ErrUnexpectedEOF 834 } 835 b := dAtA[iNdEx] 836 iNdEx++ 837 stringLen |= uint64(b&0x7F) << shift 838 if b < 0x80 { 839 break 840 } 841 } 842 intStringLen := int(stringLen) 843 if intStringLen < 0 { 844 return ErrInvalidLengthHttpgrpc 845 } 846 postIndex := iNdEx + intStringLen 847 if postIndex < 0 { 848 return ErrInvalidLengthHttpgrpc 849 } 850 if postIndex > l { 851 return io.ErrUnexpectedEOF 852 } 853 m.Url = string(dAtA[iNdEx:postIndex]) 854 iNdEx = postIndex 855 case 3: 856 if wireType != 2 { 857 return fmt.Errorf("proto: wrong wireType = %d for field Headers", wireType) 858 } 859 var msglen int 860 for shift := uint(0); ; shift += 7 { 861 if shift >= 64 { 862 return ErrIntOverflowHttpgrpc 863 } 864 if iNdEx >= l { 865 return io.ErrUnexpectedEOF 866 } 867 b := dAtA[iNdEx] 868 iNdEx++ 869 msglen |= int(b&0x7F) << shift 870 if b < 0x80 { 871 break 872 } 873 } 874 if msglen < 0 { 875 return ErrInvalidLengthHttpgrpc 876 } 877 postIndex := iNdEx + msglen 878 if postIndex < 0 { 879 return ErrInvalidLengthHttpgrpc 880 } 881 if postIndex > l { 882 return io.ErrUnexpectedEOF 883 } 884 m.Headers = append(m.Headers, &Header{}) 885 if err := m.Headers[len(m.Headers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 886 return err 887 } 888 iNdEx = postIndex 889 case 4: 890 if wireType != 2 { 891 return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) 892 } 893 var byteLen int 894 for shift := uint(0); ; shift += 7 { 895 if shift >= 64 { 896 return ErrIntOverflowHttpgrpc 897 } 898 if iNdEx >= l { 899 return io.ErrUnexpectedEOF 900 } 901 b := dAtA[iNdEx] 902 iNdEx++ 903 byteLen |= int(b&0x7F) << shift 904 if b < 0x80 { 905 break 906 } 907 } 908 if byteLen < 0 { 909 return ErrInvalidLengthHttpgrpc 910 } 911 postIndex := iNdEx + byteLen 912 if postIndex < 0 { 913 return ErrInvalidLengthHttpgrpc 914 } 915 if postIndex > l { 916 return io.ErrUnexpectedEOF 917 } 918 m.Body = append(m.Body[:0], dAtA[iNdEx:postIndex]...) 919 if m.Body == nil { 920 m.Body = []byte{} 921 } 922 iNdEx = postIndex 923 default: 924 iNdEx = preIndex 925 skippy, err := skipHttpgrpc(dAtA[iNdEx:]) 926 if err != nil { 927 return err 928 } 929 if skippy < 0 { 930 return ErrInvalidLengthHttpgrpc 931 } 932 if (iNdEx + skippy) < 0 { 933 return ErrInvalidLengthHttpgrpc 934 } 935 if (iNdEx + skippy) > l { 936 return io.ErrUnexpectedEOF 937 } 938 iNdEx += skippy 939 } 940 } 941 942 if iNdEx > l { 943 return io.ErrUnexpectedEOF 944 } 945 return nil 946 } 947 func (m *HTTPResponse) Unmarshal(dAtA []byte) error { 948 l := len(dAtA) 949 iNdEx := 0 950 for iNdEx < l { 951 preIndex := iNdEx 952 var wire uint64 953 for shift := uint(0); ; shift += 7 { 954 if shift >= 64 { 955 return ErrIntOverflowHttpgrpc 956 } 957 if iNdEx >= l { 958 return io.ErrUnexpectedEOF 959 } 960 b := dAtA[iNdEx] 961 iNdEx++ 962 wire |= uint64(b&0x7F) << shift 963 if b < 0x80 { 964 break 965 } 966 } 967 fieldNum := int32(wire >> 3) 968 wireType := int(wire & 0x7) 969 if wireType == 4 { 970 return fmt.Errorf("proto: HTTPResponse: wiretype end group for non-group") 971 } 972 if fieldNum <= 0 { 973 return fmt.Errorf("proto: HTTPResponse: illegal tag %d (wire type %d)", fieldNum, wire) 974 } 975 switch fieldNum { 976 case 1: 977 if wireType != 0 { 978 return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) 979 } 980 m.Code = 0 981 for shift := uint(0); ; shift += 7 { 982 if shift >= 64 { 983 return ErrIntOverflowHttpgrpc 984 } 985 if iNdEx >= l { 986 return io.ErrUnexpectedEOF 987 } 988 b := dAtA[iNdEx] 989 iNdEx++ 990 m.Code |= int32(b&0x7F) << shift 991 if b < 0x80 { 992 break 993 } 994 } 995 case 2: 996 if wireType != 2 { 997 return fmt.Errorf("proto: wrong wireType = %d for field Headers", wireType) 998 } 999 var msglen int 1000 for shift := uint(0); ; shift += 7 { 1001 if shift >= 64 { 1002 return ErrIntOverflowHttpgrpc 1003 } 1004 if iNdEx >= l { 1005 return io.ErrUnexpectedEOF 1006 } 1007 b := dAtA[iNdEx] 1008 iNdEx++ 1009 msglen |= int(b&0x7F) << shift 1010 if b < 0x80 { 1011 break 1012 } 1013 } 1014 if msglen < 0 { 1015 return ErrInvalidLengthHttpgrpc 1016 } 1017 postIndex := iNdEx + msglen 1018 if postIndex < 0 { 1019 return ErrInvalidLengthHttpgrpc 1020 } 1021 if postIndex > l { 1022 return io.ErrUnexpectedEOF 1023 } 1024 m.Headers = append(m.Headers, &Header{}) 1025 if err := m.Headers[len(m.Headers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { 1026 return err 1027 } 1028 iNdEx = postIndex 1029 case 3: 1030 if wireType != 2 { 1031 return fmt.Errorf("proto: wrong wireType = %d for field Body", wireType) 1032 } 1033 var byteLen int 1034 for shift := uint(0); ; shift += 7 { 1035 if shift >= 64 { 1036 return ErrIntOverflowHttpgrpc 1037 } 1038 if iNdEx >= l { 1039 return io.ErrUnexpectedEOF 1040 } 1041 b := dAtA[iNdEx] 1042 iNdEx++ 1043 byteLen |= int(b&0x7F) << shift 1044 if b < 0x80 { 1045 break 1046 } 1047 } 1048 if byteLen < 0 { 1049 return ErrInvalidLengthHttpgrpc 1050 } 1051 postIndex := iNdEx + byteLen 1052 if postIndex < 0 { 1053 return ErrInvalidLengthHttpgrpc 1054 } 1055 if postIndex > l { 1056 return io.ErrUnexpectedEOF 1057 } 1058 m.Body = append(m.Body[:0], dAtA[iNdEx:postIndex]...) 1059 if m.Body == nil { 1060 m.Body = []byte{} 1061 } 1062 iNdEx = postIndex 1063 default: 1064 iNdEx = preIndex 1065 skippy, err := skipHttpgrpc(dAtA[iNdEx:]) 1066 if err != nil { 1067 return err 1068 } 1069 if skippy < 0 { 1070 return ErrInvalidLengthHttpgrpc 1071 } 1072 if (iNdEx + skippy) < 0 { 1073 return ErrInvalidLengthHttpgrpc 1074 } 1075 if (iNdEx + skippy) > l { 1076 return io.ErrUnexpectedEOF 1077 } 1078 iNdEx += skippy 1079 } 1080 } 1081 1082 if iNdEx > l { 1083 return io.ErrUnexpectedEOF 1084 } 1085 return nil 1086 } 1087 func (m *Header) Unmarshal(dAtA []byte) error { 1088 l := len(dAtA) 1089 iNdEx := 0 1090 for iNdEx < l { 1091 preIndex := iNdEx 1092 var wire uint64 1093 for shift := uint(0); ; shift += 7 { 1094 if shift >= 64 { 1095 return ErrIntOverflowHttpgrpc 1096 } 1097 if iNdEx >= l { 1098 return io.ErrUnexpectedEOF 1099 } 1100 b := dAtA[iNdEx] 1101 iNdEx++ 1102 wire |= uint64(b&0x7F) << shift 1103 if b < 0x80 { 1104 break 1105 } 1106 } 1107 fieldNum := int32(wire >> 3) 1108 wireType := int(wire & 0x7) 1109 if wireType == 4 { 1110 return fmt.Errorf("proto: Header: wiretype end group for non-group") 1111 } 1112 if fieldNum <= 0 { 1113 return fmt.Errorf("proto: Header: illegal tag %d (wire type %d)", fieldNum, wire) 1114 } 1115 switch fieldNum { 1116 case 1: 1117 if wireType != 2 { 1118 return fmt.Errorf("proto: wrong wireType = %d for field Key", wireType) 1119 } 1120 var stringLen uint64 1121 for shift := uint(0); ; shift += 7 { 1122 if shift >= 64 { 1123 return ErrIntOverflowHttpgrpc 1124 } 1125 if iNdEx >= l { 1126 return io.ErrUnexpectedEOF 1127 } 1128 b := dAtA[iNdEx] 1129 iNdEx++ 1130 stringLen |= uint64(b&0x7F) << shift 1131 if b < 0x80 { 1132 break 1133 } 1134 } 1135 intStringLen := int(stringLen) 1136 if intStringLen < 0 { 1137 return ErrInvalidLengthHttpgrpc 1138 } 1139 postIndex := iNdEx + intStringLen 1140 if postIndex < 0 { 1141 return ErrInvalidLengthHttpgrpc 1142 } 1143 if postIndex > l { 1144 return io.ErrUnexpectedEOF 1145 } 1146 m.Key = string(dAtA[iNdEx:postIndex]) 1147 iNdEx = postIndex 1148 case 2: 1149 if wireType != 2 { 1150 return fmt.Errorf("proto: wrong wireType = %d for field Values", wireType) 1151 } 1152 var stringLen uint64 1153 for shift := uint(0); ; shift += 7 { 1154 if shift >= 64 { 1155 return ErrIntOverflowHttpgrpc 1156 } 1157 if iNdEx >= l { 1158 return io.ErrUnexpectedEOF 1159 } 1160 b := dAtA[iNdEx] 1161 iNdEx++ 1162 stringLen |= uint64(b&0x7F) << shift 1163 if b < 0x80 { 1164 break 1165 } 1166 } 1167 intStringLen := int(stringLen) 1168 if intStringLen < 0 { 1169 return ErrInvalidLengthHttpgrpc 1170 } 1171 postIndex := iNdEx + intStringLen 1172 if postIndex < 0 { 1173 return ErrInvalidLengthHttpgrpc 1174 } 1175 if postIndex > l { 1176 return io.ErrUnexpectedEOF 1177 } 1178 m.Values = append(m.Values, string(dAtA[iNdEx:postIndex])) 1179 iNdEx = postIndex 1180 default: 1181 iNdEx = preIndex 1182 skippy, err := skipHttpgrpc(dAtA[iNdEx:]) 1183 if err != nil { 1184 return err 1185 } 1186 if skippy < 0 { 1187 return ErrInvalidLengthHttpgrpc 1188 } 1189 if (iNdEx + skippy) < 0 { 1190 return ErrInvalidLengthHttpgrpc 1191 } 1192 if (iNdEx + skippy) > l { 1193 return io.ErrUnexpectedEOF 1194 } 1195 iNdEx += skippy 1196 } 1197 } 1198 1199 if iNdEx > l { 1200 return io.ErrUnexpectedEOF 1201 } 1202 return nil 1203 } 1204 func skipHttpgrpc(dAtA []byte) (n int, err error) { 1205 l := len(dAtA) 1206 iNdEx := 0 1207 depth := 0 1208 for iNdEx < l { 1209 var wire uint64 1210 for shift := uint(0); ; shift += 7 { 1211 if shift >= 64 { 1212 return 0, ErrIntOverflowHttpgrpc 1213 } 1214 if iNdEx >= l { 1215 return 0, io.ErrUnexpectedEOF 1216 } 1217 b := dAtA[iNdEx] 1218 iNdEx++ 1219 wire |= (uint64(b) & 0x7F) << shift 1220 if b < 0x80 { 1221 break 1222 } 1223 } 1224 wireType := int(wire & 0x7) 1225 switch wireType { 1226 case 0: 1227 for shift := uint(0); ; shift += 7 { 1228 if shift >= 64 { 1229 return 0, ErrIntOverflowHttpgrpc 1230 } 1231 if iNdEx >= l { 1232 return 0, io.ErrUnexpectedEOF 1233 } 1234 iNdEx++ 1235 if dAtA[iNdEx-1] < 0x80 { 1236 break 1237 } 1238 } 1239 case 1: 1240 iNdEx += 8 1241 case 2: 1242 var length int 1243 for shift := uint(0); ; shift += 7 { 1244 if shift >= 64 { 1245 return 0, ErrIntOverflowHttpgrpc 1246 } 1247 if iNdEx >= l { 1248 return 0, io.ErrUnexpectedEOF 1249 } 1250 b := dAtA[iNdEx] 1251 iNdEx++ 1252 length |= (int(b) & 0x7F) << shift 1253 if b < 0x80 { 1254 break 1255 } 1256 } 1257 if length < 0 { 1258 return 0, ErrInvalidLengthHttpgrpc 1259 } 1260 iNdEx += length 1261 case 3: 1262 depth++ 1263 case 4: 1264 if depth == 0 { 1265 return 0, ErrUnexpectedEndOfGroupHttpgrpc 1266 } 1267 depth-- 1268 case 5: 1269 iNdEx += 4 1270 default: 1271 return 0, fmt.Errorf("proto: illegal wireType %d", wireType) 1272 } 1273 if iNdEx < 0 { 1274 return 0, ErrInvalidLengthHttpgrpc 1275 } 1276 if depth == 0 { 1277 return iNdEx, nil 1278 } 1279 } 1280 return 0, io.ErrUnexpectedEOF 1281 } 1282 1283 var ( 1284 ErrInvalidLengthHttpgrpc = fmt.Errorf("proto: negative length found during unmarshaling") 1285 ErrIntOverflowHttpgrpc = fmt.Errorf("proto: integer overflow") 1286 ErrUnexpectedEndOfGroupHttpgrpc = fmt.Errorf("proto: unexpected end of group") 1287 )