github.com/cloudwego/kitex@v0.9.0/pkg/remote/trans/nphttp2/mocks_test.go (about) 1 /* 2 * Copyright 2022 CloudWeGo Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package nphttp2 18 19 import ( 20 "bytes" 21 "context" 22 "errors" 23 "io" 24 "net" 25 "reflect" 26 "sync" 27 "time" 28 29 "github.com/cloudwego/netpoll" 30 "google.golang.org/protobuf/reflect/protoreflect" 31 "google.golang.org/protobuf/runtime/protoimpl" 32 33 "github.com/cloudwego/kitex/pkg/remote" 34 "github.com/cloudwego/kitex/pkg/remote/trans/nphttp2/grpc" 35 "github.com/cloudwego/kitex/pkg/rpcinfo" 36 "github.com/cloudwego/kitex/pkg/serviceinfo" 37 "github.com/cloudwego/kitex/pkg/utils" 38 ) 39 40 var ( 41 frameHeaderLen = 9 42 prefaceLen = 24 43 prefaceByte = []byte("PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n") 44 ) 45 46 func newMockNpConn(address string) *mockNetpollConn { 47 mc := &mockNetpollConn{ 48 mockConn: mockConn{ 49 RemoteAddrFunc: func() net.Addr { return utils.NewNetAddr("tcp", address) }, 50 WriteFunc: func(b []byte) (n int, err error) { 51 // mock write preface 52 return len(b), nil 53 }, 54 }, 55 mockQueue: []mockFrame{}, 56 } 57 mc.mockConn.ReadFunc = mc.mockReader 58 mc.reader = &mockNetpollReader{reader: mc.mockConn} 59 return mc 60 } 61 62 func (mc *mockNetpollConn) mockReader(b []byte) (n int, err error) { 63 mc.counterLock.Lock() 64 defer mc.counterLock.Unlock() 65 bLen := len(b) 66 // mock: handle bufio Read() 67 if bLen == frameHeaderLen || bLen == defaultMockReadWriteBufferSize { 68 b = b[0:0] 69 if mc.queueCounter >= len(mc.mockQueue) { 70 return 71 } 72 fr := mc.mockQueue[mc.queueCounter] 73 frame := fr.header 74 b = append(b, frame...) 75 return len(b), nil 76 } 77 if bLen == prefaceLen { 78 b = b[0:0] 79 b = append(b, prefaceByte...) 80 return len(b), nil 81 } 82 83 if mc.queueCounter < len(mc.mockQueue) { 84 fr := mc.mockQueue[mc.queueCounter] 85 mc.queueCounter++ 86 body := fr.body 87 if body != nil && len(body) > 0 { 88 b = b[0:0] 89 b = append(b, body...) 90 } 91 } 92 93 return len(b), nil 94 } 95 96 type mockFrame struct { 97 header []byte 98 body []byte 99 } 100 101 var ( 102 headerPayload = []byte{131, 134, 69, 147, 99, 21, 149, 146, 249, 105, 58, 248, 172, 41, 82, 91, 24, 220, 63, 88, 203, 69, 7, 65, 139, 234, 100, 151, 202, 243, 89, 89, 23, 144, 180, 159, 95, 139, 29, 117, 208, 98, 13, 38, 61, 76, 77, 101, 100, 122, 137, 234, 100, 151, 203, 29, 192, 184, 151, 7, 64, 2, 116, 101, 134, 77, 131, 53, 5, 177, 31, 64, 137, 154, 202, 200, 178, 77, 73, 79, 106, 127, 134, 125, 247, 217, 124, 86, 255, 64, 138, 65, 237, 176, 133, 89, 5, 179, 185, 136, 95, 139, 234, 100, 151, 202, 243, 89, 89, 23, 144, 180, 159, 64, 137, 65, 237, 176, 133, 90, 146, 166, 115, 201, 0, 64, 136, 242, 178, 82, 181, 7, 152, 210, 127, 164, 0, 130, 227, 96, 109, 150, 93, 105, 151, 157, 124, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 37, 150, 89, 64, 48, 54, 228, 146, 190, 16, 134, 50, 203, 64, 135, 65, 237, 176, 133, 88, 181, 119, 131, 174, 195, 201, 64, 143, 143, 210, 75, 73, 81, 58, 210, 154, 132, 150, 197, 147, 234, 178, 255, 131, 154, 202, 201, 64, 141, 144, 168, 73, 170, 26, 76, 122, 150, 65, 108, 238, 98, 23, 139, 234, 100, 151, 202, 243, 89, 89, 23, 144, 180, 159, 64, 141, 144, 168, 73, 170, 26, 76, 122, 150, 164, 169, 156, 242, 127, 134, 220, 63, 88, 203, 69, 7, 64, 138, 144, 168, 73, 170, 26, 76, 122, 150, 52, 132, 1, 45, 64, 138, 65, 237, 176, 133, 88, 148, 90, 132, 150, 207, 133, 144, 178, 142, 218, 19, 64, 135, 65, 237, 176, 133, 88, 210, 19, 1, 45} 103 mockHeaderFrame = []byte{0, 1, 42, 1, 4, 0, 0, 0, 1} 104 mockSettingFrame = []byte{0, 0, 6, 4, 0, 0, 0, 0, 0} 105 ) 106 107 func (mc *mockNetpollConn) mockSettingFrame() { 108 mc.counterLock.Lock() 109 defer mc.counterLock.Unlock() 110 mc.mockQueue = append(mc.mockQueue, mockFrame{mockSettingFrame, nil}) 111 } 112 113 func (mc *mockNetpollConn) mockMetaHeaderFrame() { 114 mc.counterLock.Lock() 115 defer mc.counterLock.Unlock() 116 mc.mockQueue = append(mc.mockQueue, mockFrame{mockHeaderFrame, headerPayload}) 117 } 118 119 var _ netpoll.Connection = &mockNetpollConn{} 120 121 // mockNetpollConn implements netpoll.Connection. 122 type mockNetpollConn struct { 123 mockConn 124 mockQueue []mockFrame 125 queueCounter int 126 counterLock sync.Mutex 127 reader *mockNetpollReader 128 } 129 130 func (m *mockNetpollConn) Reader() netpoll.Reader { 131 return m.reader 132 } 133 134 func (m *mockNetpollConn) Writer() netpoll.Writer { 135 panic("implement me") 136 } 137 138 func (m *mockNetpollConn) IsActive() bool { 139 panic("implement me") 140 } 141 142 func (m *mockNetpollConn) SetReadTimeout(timeout time.Duration) error { 143 return nil 144 } 145 146 func (m *mockNetpollConn) SetWriteTimeout(timeout time.Duration) error { 147 return nil 148 } 149 150 func (m *mockNetpollConn) SetIdleTimeout(timeout time.Duration) error { 151 return nil 152 } 153 154 func (m *mockNetpollConn) SetOnRequest(on netpoll.OnRequest) error { 155 return nil 156 } 157 158 func (m *mockNetpollConn) AddCloseCallback(callback netpoll.CloseCallback) error { 159 return nil 160 } 161 162 func (m *mockNetpollConn) WriteFrame(hdr, data []byte) (n int, err error) { 163 return 164 } 165 166 func (m *mockNetpollConn) ReadFrame() (hdr, data []byte, err error) { 167 return 168 } 169 170 var _ netpoll.Reader = &mockNetpollReader{} 171 172 // mockNetpollReader implements netpoll.Reader. 173 type mockNetpollReader struct { 174 reader io.Reader 175 } 176 177 func (m *mockNetpollReader) Next(n int) (p []byte, err error) { 178 p = make([]byte, n) 179 _, err = m.reader.Read(p) 180 if err != nil { 181 return nil, err 182 } 183 return p, nil 184 } 185 186 func (m *mockNetpollReader) Peek(n int) (buf []byte, err error) { return } 187 func (m *mockNetpollReader) Skip(n int) (err error) { return } 188 func (m *mockNetpollReader) Until(delim byte) (line []byte, err error) { return } 189 func (m *mockNetpollReader) ReadString(n int) (s string, err error) { return } 190 func (m *mockNetpollReader) ReadBinary(n int) (p []byte, err error) { return } 191 func (m *mockNetpollReader) ReadByte() (b byte, err error) { return } 192 func (m *mockNetpollReader) Slice(n int) (r netpoll.Reader, err error) { return } 193 func (m *mockNetpollReader) Release() (err error) { return } 194 func (m *mockNetpollReader) Len() (length int) { return } 195 196 var _ net.Conn = &mockConn{} 197 198 // mockConn implements the net.Conn interface. 199 type mockConn struct { 200 ReadFunc func(b []byte) (n int, err error) 201 WriteFunc func(b []byte) (n int, err error) 202 CloseFunc func() (e error) 203 LocalAddrFunc func() (r net.Addr) 204 RemoteAddrFunc func() (r net.Addr) 205 SetDeadlineFunc func(t time.Time) (e error) 206 SetReadDeadlineFunc func(t time.Time) (e error) 207 SetWriteDeadlineFunc func(t time.Time) (e error) 208 } 209 210 // Read implements the net.Conn interface. 211 func (m mockConn) Read(b []byte) (n int, err error) { 212 if m.ReadFunc != nil { 213 return m.ReadFunc(b) 214 } 215 return 216 } 217 218 // Write implements the net.Conn interface. 219 func (m mockConn) Write(b []byte) (n int, err error) { 220 if m.WriteFunc != nil { 221 return m.WriteFunc(b) 222 } 223 return 224 } 225 226 // Close implements the net.Conn interface. 227 func (m mockConn) Close() (e error) { 228 if m.CloseFunc != nil { 229 return m.CloseFunc() 230 } 231 return 232 } 233 234 // LocalAddr implements the net.Conn interface. 235 func (m mockConn) LocalAddr() (r net.Addr) { 236 if m.LocalAddrFunc != nil { 237 return m.LocalAddrFunc() 238 } 239 return 240 } 241 242 // RemoteAddr implements the net.Conn interface. 243 func (m mockConn) RemoteAddr() (r net.Addr) { 244 if m.RemoteAddrFunc != nil { 245 return m.RemoteAddrFunc() 246 } 247 return 248 } 249 250 // SetDeadline implements the net.Conn interface. 251 func (m mockConn) SetDeadline(t time.Time) (e error) { 252 if m.SetDeadlineFunc != nil { 253 return m.SetDeadlineFunc(t) 254 } 255 return 256 } 257 258 // SetReadDeadline implements the net.Conn interface. 259 func (m mockConn) SetReadDeadline(t time.Time) (e error) { 260 if m.SetReadDeadlineFunc != nil { 261 return m.SetReadDeadlineFunc(t) 262 } 263 return 264 } 265 266 // SetWriteDeadline implements the net.Conn interface. 267 func (m mockConn) SetWriteDeadline(t time.Time) (e error) { 268 if m.SetWriteDeadlineFunc != nil { 269 return m.SetWriteDeadlineFunc(t) 270 } 271 return 272 } 273 274 var ( 275 mockAddr0 = "127.0.0.1:28000" 276 mockAddr1 = "127.0.0.1:28001" 277 ) 278 279 const defaultMockReadWriteBufferSize = 16 280 281 func newMockConnPool() *connPool { 282 connPool := NewConnPool("test", uint32(0), grpc.ConnectOptions{ 283 KeepaliveParams: grpc.ClientKeepalive{}, 284 InitialWindowSize: 0, 285 InitialConnWindowSize: 0, 286 WriteBufferSize: defaultMockReadWriteBufferSize, 287 ReadBufferSize: defaultMockReadWriteBufferSize, 288 MaxHeaderListSize: nil, 289 }) 290 return connPool 291 } 292 293 func newMockConnOption() remote.ConnOption { 294 return remote.ConnOption{Dialer: newMockDialer(), ConnectTimeout: time.Second} 295 } 296 297 func newMockServerOption() *remote.ServerOption { 298 return &remote.ServerOption{ 299 SvcSearchMap: nil, 300 TransServerFactory: nil, 301 SvrHandlerFactory: nil, 302 Codec: nil, 303 PayloadCodec: nil, 304 Address: nil, 305 ReusePort: false, 306 ExitWaitTime: 0, 307 AcceptFailedDelayTime: 0, 308 MaxConnectionIdleTime: 0, 309 ReadWriteTimeout: 0, 310 InitOrResetRPCInfoFunc: func(ri rpcinfo.RPCInfo, addr net.Addr) rpcinfo.RPCInfo { 311 return newMockRPCInfo() 312 }, 313 TracerCtl: &rpcinfo.TraceController{}, 314 GRPCCfg: &grpc.ServerConfig{ 315 MaxStreams: 0, 316 KeepaliveParams: grpc.ServerKeepalive{}, 317 KeepaliveEnforcementPolicy: grpc.EnforcementPolicy{}, 318 InitialWindowSize: 0, 319 InitialConnWindowSize: 0, 320 MaxHeaderListSize: nil, 321 }, 322 Option: remote.Option{}, 323 } 324 } 325 326 func newMockClientOption() *remote.ClientOption { 327 return &remote.ClientOption{ 328 SvcInfo: nil, 329 CliHandlerFactory: nil, 330 Codec: nil, 331 PayloadCodec: nil, 332 ConnPool: newMockConnPool(), 333 Dialer: newMockDialer(), 334 Option: remote.Option{ 335 Outbounds: nil, 336 Inbounds: nil, 337 StreamingMetaHandlers: nil, 338 }, 339 EnableConnPoolReporter: false, 340 } 341 } 342 343 func newMockDialer() *remote.SynthesizedDialer { 344 d := &remote.SynthesizedDialer{} 345 d.DialFunc = func(network, address string, timeout time.Duration) (net.Conn, error) { 346 connectCost := time.Millisecond * 10 347 if timeout < connectCost { 348 return nil, errors.New("connect timeout") 349 } 350 npConn := newMockNpConn(address) 351 npConn.mockSettingFrame() 352 return npConn, nil 353 } 354 return d 355 } 356 357 func newMockCtxWithRPCInfo() context.Context { 358 return rpcinfo.NewCtxWithRPCInfo(context.Background(), newMockRPCInfo()) 359 } 360 361 func newMockRPCInfo() rpcinfo.RPCInfo { 362 method := "method" 363 c := rpcinfo.NewEndpointInfo("", method, nil, nil) 364 endpointTags := map[string]string{} 365 endpointTags[rpcinfo.HTTPURL] = "https://github.com/cloudwego/kitex" 366 s := rpcinfo.NewEndpointInfo("", method, nil, endpointTags) 367 ink := rpcinfo.NewInvocation("", method) 368 cfg := rpcinfo.NewRPCConfig() 369 ri := rpcinfo.NewRPCInfo(c, s, ink, cfg, rpcinfo.NewRPCStats()) 370 return ri 371 } 372 373 func newMockNewMessage() *mockMessage { 374 return &mockMessage{ 375 DataFunc: func() interface{} { 376 return &HelloRequest{ 377 state: protoimpl.MessageState{}, 378 sizeCache: 0, 379 unknownFields: nil, 380 Name: "test", 381 } 382 }, 383 } 384 } 385 386 func newMockServerTransport(npConn *mockNetpollConn) (grpc.ServerTransport, error) { 387 opt := newMockServerOption() 388 tr, err := grpc.NewServerTransport(context.Background(), npConn, opt.GRPCCfg) 389 return tr, err 390 } 391 392 func mockStreamRecv(s *grpc.Stream, data string) { 393 buffer := new(bytes.Buffer) 394 buffer.Reset() 395 buffer.Write([]byte(data)) 396 grpc.StreamWrite(s, buffer) 397 } 398 399 func newMockStreamRecvHelloRequest(s *grpc.Stream) { 400 hdr := []byte{0, 0, 0, 0, 6, 10, 4, 116, 101, 115, 116, 0} 401 buffer := new(bytes.Buffer) 402 buffer.Reset() 403 buffer.Write(hdr) 404 grpc.StreamWrite(s, buffer) 405 } 406 407 var _ remote.Message = &mockMessage{} 408 409 type mockMessage struct { 410 RPCInfoFunc func() rpcinfo.RPCInfo 411 ServiceInfoFunc func() *serviceinfo.ServiceInfo 412 SetServiceInfoFunc func(svcName, methodName string) (*serviceinfo.ServiceInfo, error) 413 DataFunc func() interface{} 414 NewDataFunc func(method string) (ok bool) 415 MessageTypeFunc func() remote.MessageType 416 SetMessageTypeFunc func(remote.MessageType) 417 RPCRoleFunc func() remote.RPCRole 418 PayloadLenFunc func() int 419 SetPayloadLenFunc func(size int) 420 TransInfoFunc func() remote.TransInfo 421 TagsFunc func() map[string]interface{} 422 ProtocolInfoFunc func() remote.ProtocolInfo 423 SetProtocolInfoFunc func(remote.ProtocolInfo) 424 PayloadCodecFunc func() remote.PayloadCodec 425 SetPayloadCodecFunc func(pc remote.PayloadCodec) 426 RecycleFunc func() 427 } 428 429 func (m *mockMessage) RPCInfo() rpcinfo.RPCInfo { 430 if m.RPCInfoFunc != nil { 431 return m.RPCInfoFunc() 432 } 433 return nil 434 } 435 436 func (m *mockMessage) ServiceInfo() (si *serviceinfo.ServiceInfo) { 437 if m.ServiceInfoFunc != nil { 438 return m.ServiceInfoFunc() 439 } 440 return 441 } 442 443 func (m *mockMessage) SpecifyServiceInfo(svcName, methodName string) (si *serviceinfo.ServiceInfo, err error) { 444 if m.SetServiceInfoFunc != nil { 445 return m.SetServiceInfoFunc(svcName, methodName) 446 } 447 return nil, nil 448 } 449 450 func (m *mockMessage) Data() interface{} { 451 if m.DataFunc != nil { 452 return m.DataFunc() 453 } 454 return nil 455 } 456 457 func (m *mockMessage) NewData(method string) (ok bool) { 458 if m.NewDataFunc != nil { 459 return m.NewDataFunc(method) 460 } 461 return false 462 } 463 464 func (m *mockMessage) MessageType() (mt remote.MessageType) { 465 if m.MessageTypeFunc != nil { 466 return m.MessageTypeFunc() 467 } 468 return 469 } 470 471 func (m *mockMessage) SetMessageType(mt remote.MessageType) { 472 if m.SetMessageTypeFunc != nil { 473 m.SetMessageTypeFunc(mt) 474 } 475 } 476 477 func (m *mockMessage) RPCRole() (r remote.RPCRole) { 478 if m.RPCRoleFunc != nil { 479 return m.RPCRoleFunc() 480 } 481 return 482 } 483 484 func (m *mockMessage) PayloadLen() int { 485 if m.PayloadLenFunc != nil { 486 return m.PayloadLenFunc() 487 } 488 return 0 489 } 490 491 func (m *mockMessage) SetPayloadLen(size int) { 492 if m.SetPayloadLenFunc != nil { 493 m.SetPayloadLenFunc(size) 494 } 495 } 496 497 func (m *mockMessage) TransInfo() remote.TransInfo { 498 if m.TransInfoFunc != nil { 499 return m.TransInfoFunc() 500 } 501 return nil 502 } 503 504 func (m *mockMessage) Tags() map[string]interface{} { 505 if m.TagsFunc != nil { 506 return m.TagsFunc() 507 } 508 return nil 509 } 510 511 func (m *mockMessage) ProtocolInfo() (pi remote.ProtocolInfo) { 512 if m.ProtocolInfoFunc != nil { 513 return m.ProtocolInfoFunc() 514 } 515 return 516 } 517 518 func (m *mockMessage) SetProtocolInfo(pi remote.ProtocolInfo) { 519 if m.SetProtocolInfoFunc != nil { 520 m.SetProtocolInfoFunc(pi) 521 } 522 } 523 524 func (m *mockMessage) PayloadCodec() remote.PayloadCodec { 525 if m.PayloadCodecFunc != nil { 526 return m.PayloadCodecFunc() 527 } 528 return nil 529 } 530 531 func (m *mockMessage) SetPayloadCodec(pc remote.PayloadCodec) { 532 if m.SetPayloadCodecFunc != nil { 533 m.SetPayloadCodecFunc(pc) 534 } 535 } 536 537 func (m *mockMessage) Recycle() { 538 if m.RecycleFunc != nil { 539 m.RecycleFunc() 540 } 541 } 542 543 // Code generated by protoc-gen-go. DO NOT EDIT. 544 // versions: 545 // protoc-gen-go v1.27.1 546 // protoc v3.19.4 547 // source: message.proto 548 549 const ( 550 // Verify that this generated code is sufficiently up-to-date. 551 _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) 552 // Verify that runtime/protoimpl is sufficiently up-to-date. 553 _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) 554 ) 555 556 // The request message containing the user's name. 557 type HelloRequest struct { 558 state protoimpl.MessageState 559 sizeCache protoimpl.SizeCache 560 unknownFields protoimpl.UnknownFields 561 562 Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` 563 } 564 565 func (x *HelloRequest) Reset() { 566 *x = HelloRequest{} 567 if protoimpl.UnsafeEnabled { 568 mi := &file_message_proto_msgTypes[0] 569 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 570 ms.StoreMessageInfo(mi) 571 } 572 } 573 574 func (x *HelloRequest) String() string { 575 return protoimpl.X.MessageStringOf(x) 576 } 577 578 func (*HelloRequest) ProtoMessage() {} 579 580 func (x *HelloRequest) ProtoReflect() protoreflect.Message { 581 mi := &file_message_proto_msgTypes[0] 582 if protoimpl.UnsafeEnabled && x != nil { 583 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 584 if ms.LoadMessageInfo() == nil { 585 ms.StoreMessageInfo(mi) 586 } 587 return ms 588 } 589 return mi.MessageOf(x) 590 } 591 592 // Deprecated: Use HelloRequest.ProtoReflect.Descriptor instead. 593 func (*HelloRequest) Descriptor() ([]byte, []int) { 594 return file_message_proto_rawDescGZIP(), []int{0} 595 } 596 597 func (x *HelloRequest) GetName() string { 598 if x != nil { 599 return x.Name 600 } 601 return "" 602 } 603 604 // The response message containing the greetings 605 type HelloReply struct { 606 state protoimpl.MessageState 607 sizeCache protoimpl.SizeCache 608 unknownFields protoimpl.UnknownFields 609 610 Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` 611 } 612 613 func (x *HelloReply) Reset() { 614 *x = HelloReply{} 615 if protoimpl.UnsafeEnabled { 616 mi := &file_message_proto_msgTypes[1] 617 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 618 ms.StoreMessageInfo(mi) 619 } 620 } 621 622 func (x *HelloReply) String() string { 623 return protoimpl.X.MessageStringOf(x) 624 } 625 626 func (*HelloReply) ProtoMessage() {} 627 628 func (x *HelloReply) ProtoReflect() protoreflect.Message { 629 mi := &file_message_proto_msgTypes[1] 630 if protoimpl.UnsafeEnabled && x != nil { 631 ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 632 if ms.LoadMessageInfo() == nil { 633 ms.StoreMessageInfo(mi) 634 } 635 return ms 636 } 637 return mi.MessageOf(x) 638 } 639 640 // Deprecated: Use HelloReply.ProtoReflect.Descriptor instead. 641 func (*HelloReply) Descriptor() ([]byte, []int) { 642 return file_message_proto_rawDescGZIP(), []int{1} 643 } 644 645 func (x *HelloReply) GetMessage() string { 646 if x != nil { 647 return x.Message 648 } 649 return "" 650 } 651 652 var File_message_proto protoreflect.FileDescriptor 653 654 var file_message_proto_rawDesc = []byte{ 655 0x0a, 0x0d, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 656 0x08, 0x47, 0x72, 0x70, 0x63, 0x44, 0x65, 0x6d, 0x6f, 0x22, 0x22, 0x0a, 0x0c, 0x48, 0x65, 0x6c, 657 0x6c, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 658 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x26, 0x0a, 659 0x0a, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x6d, 660 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 661 0x73, 0x73, 0x61, 0x67, 0x65, 0x32, 0x45, 0x0a, 0x07, 0x47, 0x72, 0x65, 0x65, 0x74, 0x65, 0x72, 662 0x12, 0x3a, 0x0a, 0x08, 0x53, 0x61, 0x79, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x12, 0x16, 0x2e, 0x47, 663 0x72, 0x70, 0x63, 0x44, 0x65, 0x6d, 0x6f, 0x2e, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x71, 664 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x47, 0x72, 0x70, 0x63, 0x44, 0x65, 0x6d, 0x6f, 0x2e, 665 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x10, 0x5a, 0x0e, 666 0x64, 0x65, 0x6d, 0x6f, 0x2f, 0x6b, 0x69, 0x74, 0x65, 0x78, 0x5f, 0x67, 0x65, 0x6e, 0x62, 0x06, 667 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 668 } 669 670 var ( 671 file_message_proto_rawDescOnce sync.Once 672 file_message_proto_rawDescData = file_message_proto_rawDesc 673 ) 674 675 func file_message_proto_rawDescGZIP() []byte { 676 file_message_proto_rawDescOnce.Do(func() { 677 file_message_proto_rawDescData = protoimpl.X.CompressGZIP(file_message_proto_rawDescData) 678 }) 679 return file_message_proto_rawDescData 680 } 681 682 var ( 683 file_message_proto_msgTypes = make([]protoimpl.MessageInfo, 2) 684 file_message_proto_goTypes = []interface{}{ 685 (*HelloRequest)(nil), // 0: GrpcDemo.HelloRequest 686 (*HelloReply)(nil), // 1: GrpcDemo.HelloReply 687 } 688 ) 689 690 var file_message_proto_depIdxs = []int32{ 691 0, // 0: GrpcDemo.Greeter.SayHello:input_type -> GrpcDemo.HelloRequest 692 1, // 1: GrpcDemo.Greeter.SayHello:output_type -> GrpcDemo.HelloReply 693 1, // [1:2] is the sub-list for method output_type 694 0, // [0:1] is the sub-list for method input_type 695 0, // [0:0] is the sub-list for extension type_name 696 0, // [0:0] is the sub-list for extension extendee 697 0, // [0:0] is the sub-list for field type_name 698 } 699 700 func init() { file_message_proto_init() } 701 func file_message_proto_init() { 702 if File_message_proto != nil { 703 return 704 } 705 if !protoimpl.UnsafeEnabled { 706 file_message_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { 707 switch v := v.(*HelloRequest); i { 708 case 0: 709 return &v.state 710 case 1: 711 return &v.sizeCache 712 case 2: 713 return &v.unknownFields 714 default: 715 return nil 716 } 717 } 718 file_message_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { 719 switch v := v.(*HelloReply); i { 720 case 0: 721 return &v.state 722 case 1: 723 return &v.sizeCache 724 case 2: 725 return &v.unknownFields 726 default: 727 return nil 728 } 729 } 730 } 731 type x struct{} 732 out := protoimpl.TypeBuilder{ 733 File: protoimpl.DescBuilder{ 734 GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 735 RawDescriptor: file_message_proto_rawDesc, 736 NumEnums: 0, 737 NumMessages: 2, 738 NumExtensions: 0, 739 NumServices: 1, 740 }, 741 GoTypes: file_message_proto_goTypes, 742 DependencyIndexes: file_message_proto_depIdxs, 743 MessageInfos: file_message_proto_msgTypes, 744 }.Build() 745 File_message_proto = out.File 746 file_message_proto_rawDesc = nil 747 file_message_proto_goTypes = nil 748 file_message_proto_depIdxs = nil 749 } 750 751 var _ context.Context 752 753 // Code generated by Kitex v1.8.0. DO NOT EDIT.