| 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 |
|
| 15 |
syntax = "proto3"; |
| 16 |
|
| 17 |
// Retransmit? |
| 18 |
// Sliding windows? |
| 19 |
|
| 20 |
option go_package = "sigs.k8s.io/apiserver-network-proxy/konnectivity-client/proto/client"; |
| 21 |
|
| 22 |
service ProxyService { |
| 23 |
rpc Proxy(stream Packet) returns (stream Packet) {} |
| 24 |
} |
| 25 |
|
| 26 |
enum PacketType { |
| 27 |
DIAL_REQ = 0; |
| 28 |
DIAL_RSP = 1; |
| 29 |
CLOSE_REQ = 2; |
| 30 |
CLOSE_RSP = 3; |
| 31 |
DATA = 4; |
| 32 |
DIAL_CLS = 5; |
| 33 |
DRAIN = 6; |
| 34 |
} |
| 35 |
|
| 36 |
message Packet { |
| 37 |
PacketType type = 1; |
| 38 |
|
| 39 |
oneof payload { |
| 40 |
DialRequest dialRequest = 2; |
| 41 |
DialResponse dialResponse = 3; |
| 42 |
Data data = 4; |
| 43 |
CloseRequest closeRequest = 5; |
| 44 |
CloseResponse closeResponse = 6; |
| 45 |
CloseDial closeDial = 7; |
| 46 |
Drain drain = 8; |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
message DialRequest { |
| 51 |
// tcp or udp? |
| 52 |
string protocol = 1; |
| 53 |
|
| 54 |
// node:port |
| 55 |
string address = 2; |
| 56 |
|
| 57 |
// random id for client, maybe should be longer |
| 58 |
int64 random = 3; |
| 59 |
} |
| 60 |
|
| 61 |
message DialResponse { |
| 62 |
// error failed reason; enum? |
| 63 |
string error = 1; |
| 64 |
|
| 65 |
// connectID indicates the identifier of the connection |
| 66 |
int64 connectID = 2; |
| 67 |
|
| 68 |
// random copied from DialRequest |
| 69 |
int64 random = 3; |
| 70 |
} |
| 71 |
|
| 72 |
message CloseRequest { |
| 73 |
// connectID of the stream to close |
| 74 |
int64 connectID = 1; |
| 75 |
} |
| 76 |
|
| 77 |
message CloseResponse { |
| 78 |
// error message |
| 79 |
string error = 1; |
| 80 |
|
| 81 |
// connectID indicates the identifier of the connection |
| 82 |
int64 connectID = 2; |
| 83 |
} |
| 84 |
|
| 85 |
message CloseDial { |
| 86 |
// random id of the DialRequest |
| 87 |
int64 random = 1; |
| 88 |
} |
| 89 |
|
| 90 |
message Drain { |
| 91 |
// A hint from an Agent to Server that it is pending termination. |
| 92 |
// A Server should prefer non-draining agents for new dials. |
| 93 |
} |
| 94 |
|
| 95 |
message Data { |
| 96 |
// connectID to connect to |
| 97 |
int64 connectID = 1; |
| 98 |
|
| 99 |
// error message if error happens |
| 100 |
string error = 2; |
| 101 |
|
| 102 |
// stream data |
| 103 |
bytes data = 3; |
| 104 |
} |