forked from linkerd/linkerd2-proxy-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtap.proto
175 lines (133 loc) · 3.55 KB
/
tap.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
syntax = "proto3";
package io.linkerd.proxy.tap;
option go_package = "github.com/linkerd/linkerd2-proxy-api/go/tap";
import "google/protobuf/duration.proto";
import "http_types.proto";
import "net.proto";
// A service exposed by proxy instances to setup
service Tap {
rpc Observe(ObserveRequest) returns (stream TapEvent) {}
}
message ObserveRequest {
// Limits the number of event keys that will be returned by this tap.
uint32 limit = 1;
// Encodes request-matching logic.
Match match = 2;
message Match {
message Seq { repeated Match matches = 1; }
oneof match {
Seq all = 1;
Seq any = 2;
Match not = 3;
Tcp source = 4;
Tcp destination = 5;
Http http = 6;
Label destination_label = 7;
Label route_label = 8;
}
message Label {
string key = 1;
string value = 2;
}
message Tcp {
oneof match {
Netmask netmask = 1;
PortRange ports = 3;
}
message Netmask {
net.IPAddress ip = 1;
uint32 mask = 2;
}
// If either a minimum or maximum is not specified, the range is
// considered to be over a discrete value.
message PortRange {
// Minimum matching port value (inclusive), if specified.
uint32 min = 1;
// Maximum matching port value (inclusive), if specified.
uint32 max = 2;
}
}
message Http {
oneof match {
http_types.Scheme scheme = 1;
http_types.HttpMethod method = 3;
StringMatch authority = 2;
StringMatch path = 4;
// TODO Header header = 4;
}
message StringMatch {
oneof match {
string exact = 1;
string prefix = 2;
}
}
}
}
// Conditionally extracts components from requests and responses to include
// in tap events
Extract extract = 3;
message Extract {
oneof extract { Http http = 1; }
message Http {
oneof extract { Headers headers = 1; }
message Headers {}
}
}
}
message Eos {
oneof end {
uint32 grpc_status_code = 1;
uint32 reset_error_code = 2;
}
}
message TapEvent {
net.TcpAddress source = 1;
EndpointMeta source_meta = 5;
RouteMeta route_meta = 7;
net.TcpAddress destination = 2;
EndpointMeta destination_meta = 4;
ProxyDirection proxy_direction = 6;
enum ProxyDirection {
UNKNOWN = 0;
INBOUND = 1;
OUTBOUND = 2;
}
oneof event { Http http = 3; }
message EndpointMeta { map<string, string> labels = 1; }
message RouteMeta { map<string, string> labels = 1; }
message Http {
oneof event {
RequestInit request_init = 1;
ResponseInit response_init = 2;
ResponseEnd response_end = 3;
}
message StreamId {
// A randomized base (stable across a process's runtime)
uint32 base = 1;
// A stream id unique within the lifetime of `base`.
uint64 stream = 2;
}
message RequestInit {
StreamId id = 1;
http_types.HttpMethod method = 2;
http_types.Scheme scheme = 3;
string authority = 4;
string path = 5;
http_types.Headers headers = 6;
}
message ResponseInit {
StreamId id = 1;
google.protobuf.Duration since_request_init = 2;
uint32 http_status = 3;
http_types.Headers headers = 4;
}
message ResponseEnd {
StreamId id = 1;
google.protobuf.Duration since_request_init = 2;
google.protobuf.Duration since_response_init = 3;
uint64 response_bytes = 4;
Eos eos = 5;
http_types.Headers trailers = 6;
}
}
}