client.proto 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // Copyright The Kubernetes Authors.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. syntax = "proto3";
  15. // Retransmit?
  16. // Sliding windows?
  17. option go_package = "sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client";
  18. service ProxyService {
  19. rpc Proxy(stream Packet) returns (stream Packet) {}
  20. }
  21. enum PacketType {
  22. DIAL_REQ = 0;
  23. DIAL_RSP = 1;
  24. CLOSE_REQ = 2;
  25. CLOSE_RSP = 3;
  26. DATA = 4;
  27. }
  28. enum Error {
  29. EOF = 0;
  30. // ...
  31. }
  32. message Packet {
  33. PacketType type = 1;
  34. oneof payload {
  35. DialRequest dialRequest = 2;
  36. DialResponse dialResponse = 3;
  37. Data data = 4;
  38. CloseRequest closeRequest = 5;
  39. CloseResponse closeResponse = 6;
  40. }
  41. }
  42. message DialRequest {
  43. // tcp or udp?
  44. string protocol = 1;
  45. // node:port
  46. string address = 2;
  47. // random id for client, maybe should be longer
  48. int64 random = 3;
  49. }
  50. message DialResponse {
  51. // error failed reason; enum?
  52. string error = 1;
  53. // connectID indicates the identifier of the connection
  54. int64 connectID = 2;
  55. // random copied from DialRequest
  56. int64 random = 3;
  57. }
  58. message CloseRequest {
  59. // connectID of the stream to close
  60. int64 connectID = 1;
  61. }
  62. message CloseResponse {
  63. // error message
  64. string error = 1;
  65. // connectID indicates the identifier of the connection
  66. int64 connectID = 2;
  67. }
  68. message Data {
  69. // connectID to connect to
  70. int64 connectID = 1;
  71. // error message if error happens
  72. string error = 2;
  73. // stream data
  74. bytes data = 3;
  75. }