logstash-codec-protobuf 1.0.5 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +20 -1
- data/Gemfile +1 -1
- data/LICENSE +2 -3
- data/README.md +147 -40
- data/docs/index.asciidoc +173 -41
- data/lib/logstash/codecs/protobuf.rb +598 -238
- data/logstash-codec-protobuf.gemspec +3 -3
- data/spec/codecs/{protobuf_spec.rb → pb2_spec.rb} +81 -54
- data/spec/codecs/pb3_decode_spec.rb +445 -0
- data/spec/codecs/pb3_encode_spec.rb +243 -0
- data/spec/helpers/pb2/event.pb.rb +19 -0
- data/spec/helpers/pb2/event.proto +12 -0
- data/spec/helpers/pb2/header/header.pb.rb +16 -0
- data/spec/helpers/pb2/header/header.proto +8 -0
- data/spec/helpers/pb3/FantasyHorse_pb.rb +44 -0
- data/spec/helpers/pb3/ProbeResult_pb.rb +26 -0
- data/spec/helpers/pb3/dnsmessage_pb.rb +82 -0
- data/spec/helpers/pb3/events.proto3 +10 -0
- data/spec/helpers/pb3/events_pb.rb +17 -0
- data/spec/helpers/pb3/header/header.proto3 +7 -0
- data/spec/helpers/pb3/header/header_pb.rb +12 -0
- data/spec/helpers/pb3/integertest_pb.rb +20 -0
- data/spec/helpers/pb3/messageA.proto3 +12 -0
- data/spec/helpers/pb3/messageA_pb.rb +16 -0
- data/spec/helpers/pb3/messageB.proto3 +12 -0
- data/spec/helpers/pb3/messageB_pb.rb +16 -0
- data/spec/helpers/pb3/rum2_pb.rb +87 -0
- data/spec/helpers/pb3/rum3_pb.rb +87 -0
- data/spec/helpers/pb3/rum_pb.rb +87 -0
- metadata +62 -34
- data/lib/net/jpountz/lz4/lz4/1.3.0/lz4-1.3.0.jar +0 -0
- data/lib/org/apache/kafka/kafka-clients/0.11.0.0/kafka-clients-0.11.0.0.jar +0 -0
- data/lib/org/apache/logging/log4j/log4j-api/2.8.2/log4j-api-2.8.2.jar +0 -0
- data/lib/org/apache/logging/log4j/log4j-slf4j-impl/2.8.2/log4j-slf4j-impl-2.8.2.jar +0 -0
- data/lib/org/slf4j/slf4j-api/1.7.24/slf4j-api-1.7.24.jar +0 -0
- data/lib/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar +0 -0
- data/lib/org/xerial/snappy/snappy-java/1.1.2.6/snappy-java-1.1.2.6.jar +0 -0
- data/spec/codecs/protobuf3_spec.rb +0 -147
- data/vendor/jar-dependencies/runtime-jars/kafka-clients-0.11.0.0.jar +0 -0
- data/vendor/jar-dependencies/runtime-jars/log4j-api-2.8.2.jar +0 -0
- data/vendor/jar-dependencies/runtime-jars/log4j-slf4j-impl-2.8.2.jar +0 -0
- data/vendor/jar-dependencies/runtime-jars/lz4-1.3.0.jar +0 -0
- data/vendor/jar-dependencies/runtime-jars/slf4j-api-1.7.24.jar +0 -0
- data/vendor/jar-dependencies/runtime-jars/slf4j-api-1.7.25.jar +0 -0
- data/vendor/jar-dependencies/runtime-jars/snappy-java-1.1.2.6.jar +0 -0
@@ -0,0 +1,243 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "logstash/devutils/rspec/spec_helper"
|
3
|
+
require "logstash/codecs/protobuf"
|
4
|
+
require "logstash/event"
|
5
|
+
|
6
|
+
require 'google/protobuf' # for protobuf3
|
7
|
+
|
8
|
+
# absolute path to the protobuf helpers directory
|
9
|
+
pb_include_path = File.expand_path(".") + "/spec/helpers"
|
10
|
+
|
11
|
+
describe LogStash::Codecs::Protobuf do
|
12
|
+
|
13
|
+
context "#encodePB3-a" do
|
14
|
+
|
15
|
+
#### Test case 1: encode simple protobuf ####################################################################################################################
|
16
|
+
|
17
|
+
require_relative '../helpers/pb3/unicorn_pb.rb'
|
18
|
+
|
19
|
+
subject do
|
20
|
+
next LogStash::Codecs::Protobuf.new("class_name" => "Unicorn", "include_path" => [pb_include_path + '/pb3/unicorn_pb.rb'], "protobuf_version" => 3)
|
21
|
+
end
|
22
|
+
|
23
|
+
event1 = LogStash::Event.new("name" => "Pinkie", "age" => 18, "is_pegasus" => false, "favourite_numbers" => [1,2,3], "fur_colour" => Colour::PINK, "favourite_colours" => [1,5] )
|
24
|
+
|
25
|
+
it "should return protobuf encoded data for testcase 1" do
|
26
|
+
|
27
|
+
subject.on_event do |event, data|
|
28
|
+
expect(data).to be_a(String)
|
29
|
+
|
30
|
+
pb_builder = Google::Protobuf::DescriptorPool.generated_pool.lookup("Unicorn").msgclass
|
31
|
+
decoded_data = pb_builder.decode(data)
|
32
|
+
expect(decoded_data.name ).to eq(event.get("name") )
|
33
|
+
expect(decoded_data.age ).to eq(event.get("age") )
|
34
|
+
expect(decoded_data.is_pegasus ).to eq(event.get("is_pegasus") )
|
35
|
+
expect(decoded_data.fur_colour ).to eq(:PINK)
|
36
|
+
expect(decoded_data.favourite_numbers ).to eq(event.get("favourite_numbers") )
|
37
|
+
expect(decoded_data.favourite_colours ).to eq([:BLUE,:WHITE] )
|
38
|
+
end # subject.on_event
|
39
|
+
|
40
|
+
subject.encode(event1)
|
41
|
+
end # it
|
42
|
+
|
43
|
+
end # context
|
44
|
+
|
45
|
+
context "#encodePB3-b" do
|
46
|
+
|
47
|
+
#### Test case 2: encode nested protobuf ####################################################################################################################
|
48
|
+
|
49
|
+
require_relative '../helpers/pb3/unicorn_pb.rb'
|
50
|
+
|
51
|
+
subject do
|
52
|
+
next LogStash::Codecs::Protobuf.new("class_name" => "Unicorn", "include_path" => [pb_include_path + '/pb3/unicorn_pb.rb'], "protobuf_version" => 3)
|
53
|
+
end
|
54
|
+
|
55
|
+
event = LogStash::Event.new("name" => "Horst", "age" => 23, "is_pegasus" => true, "mother" => \
|
56
|
+
{"name" => "Mom", "age" => 47}, "father" => {"name"=> "Daddy", "age"=> 50, "fur_colour" => 3 } # 3 == SILVER
|
57
|
+
)
|
58
|
+
|
59
|
+
it "should return protobuf encoded data for testcase 2" do
|
60
|
+
|
61
|
+
subject.on_event do |event, data|
|
62
|
+
expect(data).to be_a(String)
|
63
|
+
|
64
|
+
pb_builder = Google::Protobuf::DescriptorPool.generated_pool.lookup("Unicorn").msgclass
|
65
|
+
decoded_data = pb_builder.decode(data)
|
66
|
+
|
67
|
+
expect(decoded_data.name ).to eq(event.get("name") )
|
68
|
+
expect(decoded_data.age ).to eq(event.get("age") )
|
69
|
+
expect(decoded_data.is_pegasus ).to eq(event.get("is_pegasus") )
|
70
|
+
expect(decoded_data.mother.name ).to eq(event.get("mother")["name"] )
|
71
|
+
expect(decoded_data.mother.age ).to eq(event.get("mother")["age"] )
|
72
|
+
expect(decoded_data.father.name ).to eq(event.get("father")["name"] )
|
73
|
+
expect(decoded_data.father.age ).to eq(event.get("father")["age"] )
|
74
|
+
expect(decoded_data.father.fur_colour ).to eq(:SILVER)
|
75
|
+
|
76
|
+
|
77
|
+
end # subject4.on_event
|
78
|
+
subject.encode(event)
|
79
|
+
end # it
|
80
|
+
|
81
|
+
end # context #encodePB3
|
82
|
+
|
83
|
+
context "encodePB3-c" do
|
84
|
+
|
85
|
+
#### Test case 3: encode nested protobuf ####################################################################################################################
|
86
|
+
|
87
|
+
|
88
|
+
subject do
|
89
|
+
next LogStash::Codecs::Protobuf.new("class_name" => "something.rum_akamai.ProtoAkamaiRum", "include_path" => [pb_include_path + '/pb3/rum_pb.rb' ], "protobuf_version" => 3)
|
90
|
+
end
|
91
|
+
|
92
|
+
event = LogStash::Event.new(
|
93
|
+
"user_agent"=>{"os"=>"Android OS", "family"=>"Chrome Mobile", "major"=>74, "mobile"=>"1", "minor"=>0, "manufacturer"=>"Samsung", "osversion"=>"8",
|
94
|
+
"model"=>"Galaxy S7 Edge", "type"=>"Mobile",
|
95
|
+
"raw"=>"Mozilla/5.0 (Linux; Android 8.0.0; SM-G935F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Mobile Safari/537.36"},
|
96
|
+
"dom"=>{"script"=>65, "ln"=>2063, "ext"=>47}, "page_group"=>"SEO-Pages",
|
97
|
+
"active_ctests"=>["1443703219", "47121", "47048", "46906"], "timestamp"=>"1559566982508",
|
98
|
+
"geo"=>{"isp"=>"Telecom Italia Mobile", "lat"=>45.4643, "postalcode"=>"20123", "netspeed"=>"Cellular", "rg"=>"MI", "cc"=>"IT",
|
99
|
+
"organisation"=>"Telecom Italia Mobile", "ovr"=>false, "city"=>"Milan", "lon"=>9.1895},
|
100
|
+
"header"=>{"sender_id"=>"0"}, "domain"=>"something.com", "url"=>"https://www.something.it/",
|
101
|
+
"timers"=>{"tti"=>4544, "ttvr"=>3657, "fcp"=>2683, "ttfi"=>4280, "fid"=>31, "longtasks"=>2519, "t_resp"=>1748}
|
102
|
+
)
|
103
|
+
|
104
|
+
it "should return protobuf encoded data for testcase 3" do
|
105
|
+
|
106
|
+
subject.on_event do |event, data|
|
107
|
+
expect(data).to be_a(String)
|
108
|
+
|
109
|
+
pb_builder = Google::Protobuf::DescriptorPool.generated_pool.lookup("something.rum_akamai.ProtoAkamaiRum").msgclass
|
110
|
+
decoded_data = pb_builder.decode(data)
|
111
|
+
|
112
|
+
expect(decoded_data.domain ).to eq(event.get("domain") )
|
113
|
+
expect(decoded_data.dom.ext ).to eq(event.get("dom")["ext"] )
|
114
|
+
expect(decoded_data.user_agent.type ).to eq(event.get("user_agent")["type"] )
|
115
|
+
expect(decoded_data.geo.rg ).to eq(event.get("geo")["rg"] )
|
116
|
+
|
117
|
+
|
118
|
+
end # subject4.on_event
|
119
|
+
subject.encode(event)
|
120
|
+
end # it
|
121
|
+
end # context #encodePB3-c
|
122
|
+
|
123
|
+
|
124
|
+
context "encodePB3-d" do
|
125
|
+
|
126
|
+
#### Test case 3: autoconvert data types ####################################################################################################################
|
127
|
+
|
128
|
+
|
129
|
+
subject do
|
130
|
+
next LogStash::Codecs::Protobuf.new("class_name" => "something.rum_akamai.ProtoAkamai2Rum",
|
131
|
+
"pb3_encoder_autoconvert_types" => true,
|
132
|
+
"include_path" => [pb_include_path + '/pb3/rum2_pb.rb' ], "protobuf_version" => 3)
|
133
|
+
end
|
134
|
+
|
135
|
+
event = LogStash::Event.new(
|
136
|
+
|
137
|
+
# major should autoconvert to float
|
138
|
+
"user_agent"=>{"minor"=>0,"major"=>"74"},
|
139
|
+
|
140
|
+
# ext should autoconvert to int. script being empty should be ignored.
|
141
|
+
"dom"=>{"script"=>nil, "ln"=>2063, "ext"=>47.0},
|
142
|
+
|
143
|
+
# ovr should autoconvert to Boolean
|
144
|
+
"geo"=>{"ovr"=>"false"},
|
145
|
+
|
146
|
+
# sender_id should autoconvert to string
|
147
|
+
"header"=>{"sender_id"=>1},
|
148
|
+
"domain" => "www",
|
149
|
+
|
150
|
+
# should autoconvert to string
|
151
|
+
"http_referer" => 1234,
|
152
|
+
)
|
153
|
+
|
154
|
+
|
155
|
+
it "should fix datatypes to match the protobuf definition" do
|
156
|
+
|
157
|
+
subject.on_event do |event, data|
|
158
|
+
expect(data).to be_a(String)
|
159
|
+
|
160
|
+
pb_builder = Google::Protobuf::DescriptorPool.generated_pool.lookup("something.rum_akamai.ProtoAkamai2Rum").msgclass
|
161
|
+
decoded_data = pb_builder.decode(data)
|
162
|
+
expect(decoded_data.domain ).to eq(event.get("domain") )
|
163
|
+
expect(decoded_data.user_agent.major).to eq(74)
|
164
|
+
expect(decoded_data.dom.ext).to eq(47)
|
165
|
+
expect(decoded_data.geo.ovr).to eq(false)
|
166
|
+
expect(decoded_data.header.sender_id).to eq("1")
|
167
|
+
expect(decoded_data.http_referer).to eq("1234")
|
168
|
+
|
169
|
+
end
|
170
|
+
subject.encode(event)
|
171
|
+
end # it
|
172
|
+
|
173
|
+
end # context #encodePB3-d
|
174
|
+
|
175
|
+
|
176
|
+
context "encodePB3-e" do
|
177
|
+
|
178
|
+
#### Test case 4: handle nil data ####################################################################################################################
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
subject do
|
183
|
+
next LogStash::Codecs::Protobuf.new("class_name" => "something.rum_akamai.ProtoAkamai3Rum",
|
184
|
+
"pb3_encoder_autoconvert_types" => false,
|
185
|
+
"include_path" => [pb_include_path + '/pb3/rum3_pb.rb' ], "protobuf_version" => 3)
|
186
|
+
end
|
187
|
+
|
188
|
+
event = LogStash::Event.new(
|
189
|
+
"domain" => nil,
|
190
|
+
"header" => {"sender_id" => "23"},
|
191
|
+
"geo"=>{"organisation"=>"Jio", "rg"=>"DL", "netspeed"=>nil, "city"=>nil, "cc"=>"IN", "ovr"=>false, "postalcode"=>"110012", "isp"=>"Jio"}
|
192
|
+
)
|
193
|
+
|
194
|
+
it "should ignore empty fields" do
|
195
|
+
|
196
|
+
subject.on_event do |event, data|
|
197
|
+
expect(data).to be_a(String)
|
198
|
+
|
199
|
+
pb_builder = Google::Protobuf::DescriptorPool.generated_pool.lookup("something.rum_akamai.ProtoAkamai3Rum").msgclass
|
200
|
+
decoded_data = pb_builder.decode(data)
|
201
|
+
expect(decoded_data.geo.organisation ).to eq(event.get("geo")["organisation"])
|
202
|
+
expect(decoded_data.geo.ovr ).to eq(event.get("geo")["ovr"])
|
203
|
+
expect(decoded_data.geo.postalcode ).to eq(event.get("geo")["postalcode"])
|
204
|
+
expect(decoded_data.header.sender_id ).to eq(event.get("header")['sender_id'] )
|
205
|
+
|
206
|
+
end
|
207
|
+
subject.encode(event)
|
208
|
+
end # it
|
209
|
+
|
210
|
+
end # context #encodePB3-e
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
context "encodePB3-f" do
|
215
|
+
|
216
|
+
#### Test case 5: handle additional fields (discard event without crashing pipeline) ####################################################################################################################
|
217
|
+
|
218
|
+
subject do
|
219
|
+
next LogStash::Codecs::Protobuf.new("class_name" => "something.rum_akamai.ProtoAkamai3Rum",
|
220
|
+
"pb3_encoder_autoconvert_types" => false,
|
221
|
+
"include_path" => [pb_include_path + '/pb3/rum3_pb.rb' ], "protobuf_version" => 3)
|
222
|
+
end
|
223
|
+
|
224
|
+
event = LogStash::Event.new(
|
225
|
+
"domain" => nil, "bot" => "This field does not exist in the protobuf definition",
|
226
|
+
"header" => {"sender_id" => "23"},
|
227
|
+
"geo"=>{"organisation"=>"Jio", "rg"=>"DL", "netspeed"=>nil, "city"=>nil, "cc"=>"IN", "ovr"=>false, "postalcode"=>"110012", "isp"=>"Jio"}
|
228
|
+
)
|
229
|
+
|
230
|
+
it "should not return data" do
|
231
|
+
|
232
|
+
subject.on_event do |event, data|
|
233
|
+
expect("the on_event method should not be called").to eq("so this code should never be reached")
|
234
|
+
end
|
235
|
+
subject.encode(event)
|
236
|
+
end # it
|
237
|
+
|
238
|
+
end # context #encodePB3-f
|
239
|
+
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
end # describe
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
|
4
|
+
require 'protocol_buffers'
|
5
|
+
|
6
|
+
begin; require 'header/header.pb'; rescue LoadError; end
|
7
|
+
|
8
|
+
module Logging
|
9
|
+
# forward declarations
|
10
|
+
class Event < ::ProtocolBuffers::Message; end
|
11
|
+
|
12
|
+
class Event < ::ProtocolBuffers::Message
|
13
|
+
set_fully_qualified_name "Logging.Event"
|
14
|
+
|
15
|
+
optional :string, :name, 1
|
16
|
+
optional ::Grpc::Header, :header, 2
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
|
4
|
+
require 'protocol_buffers'
|
5
|
+
|
6
|
+
module Grpc
|
7
|
+
# forward declarations
|
8
|
+
class Header < ::ProtocolBuffers::Message; end
|
9
|
+
|
10
|
+
class Header < ::ProtocolBuffers::Message
|
11
|
+
set_fully_qualified_name "grpc.Header"
|
12
|
+
|
13
|
+
optional :string, :protocol, 1
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
|
3
|
+
begin; require 'google/protobuf'; rescue LoadError; end
|
4
|
+
|
5
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
6
|
+
add_message "FantasyHorse" do
|
7
|
+
optional :name, :string, 1
|
8
|
+
oneof :horse_type do
|
9
|
+
optional :unicorn, :message, 2, "FantasyUnicorn"
|
10
|
+
optional :pegasus, :message, 3, "FantasyPegasus"
|
11
|
+
end
|
12
|
+
optional :tail, :message, 4, "FantasyHorseTail"
|
13
|
+
end
|
14
|
+
add_message "FantasyUnicorn" do
|
15
|
+
optional :horn_length, :int32, 1
|
16
|
+
optional :horn_colour, :string, 2
|
17
|
+
end
|
18
|
+
add_message "FantasyPegasus" do
|
19
|
+
optional :wings_length, :int32, 1
|
20
|
+
optional :wings_width, :int32, 2
|
21
|
+
optional :wings_feathers, :string, 3
|
22
|
+
end
|
23
|
+
add_message "FantasyHorseTail" do
|
24
|
+
optional :tail_length, :int32, 1
|
25
|
+
oneof :hair_type do
|
26
|
+
optional :braided, :message, 2, "BraidedHorseTail"
|
27
|
+
optional :natural, :message, 3, "NaturalHorseTail"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
add_message "BraidedHorseTail" do
|
31
|
+
optional :braiding_style, :string, 1
|
32
|
+
optional :braid_thickness, :int32, 2
|
33
|
+
end
|
34
|
+
add_message "NaturalHorseTail" do
|
35
|
+
optional :wavyness, :string, 1
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
FantasyHorse = Google::Protobuf::DescriptorPool.generated_pool.lookup("FantasyHorse").msgclass
|
40
|
+
FantasyUnicorn = Google::Protobuf::DescriptorPool.generated_pool.lookup("FantasyUnicorn").msgclass
|
41
|
+
FantasyPegasus = Google::Protobuf::DescriptorPool.generated_pool.lookup("FantasyPegasus").msgclass
|
42
|
+
FantasyHorseTail = Google::Protobuf::DescriptorPool.generated_pool.lookup("FantasyHorseTail").msgclass
|
43
|
+
BraidedHorseTail = Google::Protobuf::DescriptorPool.generated_pool.lookup("BraidedHorseTail").msgclass
|
44
|
+
NaturalHorseTail = Google::Protobuf::DescriptorPool.generated_pool.lookup("NaturalHorseTail").msgclass
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: results.proto
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_message "ProbeResult" do
|
8
|
+
optional :UUID, :string, 1
|
9
|
+
optional :TaskPingIPv4Result, :message, 2, "PingIPv4Result"
|
10
|
+
end
|
11
|
+
add_message "PingIPv4Result" do
|
12
|
+
optional :status, :enum, 2, "PingIPv4Result.Status"
|
13
|
+
optional :latency, :double, 3
|
14
|
+
optional :ip, :string, 4
|
15
|
+
optional :probe_ip, :string, 5
|
16
|
+
optional :geolocation, :string, 6
|
17
|
+
end
|
18
|
+
add_enum "PingIPv4Result.Status" do
|
19
|
+
value :OK, 0
|
20
|
+
value :ERROR, 1
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
ProbeResult = Google::Protobuf::DescriptorPool.generated_pool.lookup("ProbeResult").msgclass
|
25
|
+
PingIPv4Result = Google::Protobuf::DescriptorPool.generated_pool.lookup("PingIPv4Result").msgclass
|
26
|
+
PingIPv4Result::Status = Google::Protobuf::DescriptorPool.generated_pool.lookup("PingIPv4Result.Status").enummodule
|
@@ -0,0 +1,82 @@
|
|
1
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
2
|
+
# source: dnsmessage.proto3
|
3
|
+
|
4
|
+
require 'google/protobuf'
|
5
|
+
|
6
|
+
Google::Protobuf::DescriptorPool.generated_pool.build do
|
7
|
+
add_message "PBDNSMessage" do
|
8
|
+
optional :type, :enum, 1, "PBDNSMessage.Type"
|
9
|
+
optional :messageId, :bytes, 2
|
10
|
+
optional :serverIdentity, :bytes, 3
|
11
|
+
optional :socketFamily, :enum, 4, "PBDNSMessage.SocketFamily"
|
12
|
+
optional :socketProtocol, :enum, 5, "PBDNSMessage.SocketProtocol"
|
13
|
+
optional :from, :bytes, 6
|
14
|
+
optional :to, :bytes, 7
|
15
|
+
optional :inBytes, :uint64, 8
|
16
|
+
optional :timeSec, :uint32, 9
|
17
|
+
optional :timeUsec, :uint32, 10
|
18
|
+
optional :id, :uint32, 11
|
19
|
+
optional :question, :message, 12, "PBDNSMessage.DNSQuestion"
|
20
|
+
optional :response, :message, 13, "PBDNSMessage.DNSResponse"
|
21
|
+
optional :originalRequestorSubnet, :bytes, 14
|
22
|
+
optional :requestorId, :string, 15
|
23
|
+
optional :initialRequestId, :bytes, 16
|
24
|
+
optional :deviceId, :bytes, 17
|
25
|
+
end
|
26
|
+
add_message "PBDNSMessage.DNSQuestion" do
|
27
|
+
optional :qName, :string, 1
|
28
|
+
optional :qType, :uint32, 2
|
29
|
+
optional :qClass, :uint32, 3
|
30
|
+
end
|
31
|
+
add_message "PBDNSMessage.DNSResponse" do
|
32
|
+
optional :rcode, :uint32, 1
|
33
|
+
repeated :rrs, :message, 2, "PBDNSMessage.DNSResponse.DNSRR"
|
34
|
+
optional :appliedPolicy, :string, 3
|
35
|
+
repeated :tags, :string, 4
|
36
|
+
optional :queryTimeSec, :uint32, 5
|
37
|
+
optional :queryTimeUsec, :uint32, 6
|
38
|
+
optional :appliedPolicyType, :enum, 7, "PBDNSMessage.PolicyType"
|
39
|
+
end
|
40
|
+
add_message "PBDNSMessage.DNSResponse.DNSRR" do
|
41
|
+
optional :name, :string, 1
|
42
|
+
optional :type, :uint32, 2
|
43
|
+
optional :class, :uint32, 3
|
44
|
+
optional :ttl, :uint32, 4
|
45
|
+
optional :rdata, :bytes, 5
|
46
|
+
end
|
47
|
+
add_enum "PBDNSMessage.Type" do
|
48
|
+
value :Dummy0, 0
|
49
|
+
value :DNSQueryType, 1
|
50
|
+
value :DNSResponseType, 2
|
51
|
+
value :DNSOutgoingQueryType, 3
|
52
|
+
value :DNSIncomingResponseType, 4
|
53
|
+
end
|
54
|
+
add_enum "PBDNSMessage.SocketFamily" do
|
55
|
+
value :Dummy1, 0
|
56
|
+
value :INET, 1
|
57
|
+
value :INET6, 2
|
58
|
+
end
|
59
|
+
add_enum "PBDNSMessage.SocketProtocol" do
|
60
|
+
value :Dummy2, 0
|
61
|
+
value :UDP, 1
|
62
|
+
value :TCP, 2
|
63
|
+
end
|
64
|
+
add_enum "PBDNSMessage.PolicyType" do
|
65
|
+
value :Dummy3, 0
|
66
|
+
value :UNKNOWN, 1
|
67
|
+
value :QNAME, 2
|
68
|
+
value :CLIENTIP, 3
|
69
|
+
value :RESPONSEIP, 4
|
70
|
+
value :NSDNAME, 5
|
71
|
+
value :NSIP, 6
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
PBDNSMessage = Google::Protobuf::DescriptorPool.generated_pool.lookup("PBDNSMessage").msgclass
|
76
|
+
PBDNSMessage::DNSQuestion = Google::Protobuf::DescriptorPool.generated_pool.lookup("PBDNSMessage.DNSQuestion").msgclass
|
77
|
+
PBDNSMessage::DNSResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("PBDNSMessage.DNSResponse").msgclass
|
78
|
+
PBDNSMessage::DNSResponse::DNSRR = Google::Protobuf::DescriptorPool.generated_pool.lookup("PBDNSMessage.DNSResponse.DNSRR").msgclass
|
79
|
+
PBDNSMessage::Type = Google::Protobuf::DescriptorPool.generated_pool.lookup("PBDNSMessage.Type").enummodule
|
80
|
+
PBDNSMessage::SocketFamily = Google::Protobuf::DescriptorPool.generated_pool.lookup("PBDNSMessage.SocketFamily").enummodule
|
81
|
+
PBDNSMessage::SocketProtocol = Google::Protobuf::DescriptorPool.generated_pool.lookup("PBDNSMessage.SocketProtocol").enummodule
|
82
|
+
PBDNSMessage::PolicyType = Google::Protobuf::DescriptorPool.generated_pool.lookup("PBDNSMessage.PolicyType").enummodule
|