tunnelmtu 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/tunnelmtu +81 -13
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fedd2feeac99317503cdbd9e4aa6b473e21bdd069b1a71e208068db414ef697e
|
|
4
|
+
data.tar.gz: d2abd866c468188ddd703fb4f67d7172d183bc8a385748f288d70f58c96ff358
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a43fb476a7d0c17dbe126f0828f8bbd51ecb6eeda28dcd241c747fad833b3364c67e6045a9a5c6321aef442ef3ef11a2538310916fe7262a61436740d71abe92
|
|
7
|
+
data.tar.gz: 887d916b22c6533c5d45b037668d86d8fa20dc8aacf360dd52b7f370e480860df60deadb3ac10debebd71ea793a2158d445ec92b3a210b23da75f70e7ce0f70d
|
data/bin/tunnelmtu
CHANGED
|
@@ -38,13 +38,14 @@ def ask_openssl_digest
|
|
|
38
38
|
return digests.find { |d| d[:name] == selected_digest }
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
-
def ask_openssl_cipher
|
|
41
|
+
def ask_openssl_cipher(chacha20 = false)
|
|
42
42
|
ciphers = [
|
|
43
43
|
{ name: 'AES', iv_size: 16 },
|
|
44
44
|
{ name: 'ARIA', iv_size: 16 },
|
|
45
45
|
{ name: 'CAMELLIA', iv_size: 16 },
|
|
46
46
|
{ name: 'DES', iv_size: 8 }
|
|
47
47
|
]
|
|
48
|
+
ciphers << { name: 'CHACHA20', iv_size: 0 } if chacha20
|
|
48
49
|
ciphers_list = ciphers.map { |v| v[:name] }
|
|
49
50
|
|
|
50
51
|
selected_cipher = CLI::UI.ask('Which cipher algorithm?', options: ciphers_list)
|
|
@@ -64,7 +65,7 @@ CLI::UI::StdoutRouter.enable
|
|
|
64
65
|
CLI::UI.frame_style = :bracket
|
|
65
66
|
|
|
66
67
|
CLI::UI::Frame.open('Tunneling MTU calculator', color: :cyan) do
|
|
67
|
-
outer_mtu = CLI::UI.ask('What is the outer MTU?').to_i
|
|
68
|
+
outer_mtu = CLI::UI.ask('What is the outer MTU?', default: '1500').to_i
|
|
68
69
|
mtu = outer_mtu
|
|
69
70
|
explanations = []
|
|
70
71
|
|
|
@@ -80,7 +81,7 @@ CLI::UI::Frame.open('Tunneling MTU calculator', color: :cyan) do
|
|
|
80
81
|
end
|
|
81
82
|
end
|
|
82
83
|
|
|
83
|
-
CLI::UI.ask('Will PPPoE be used for connection?') do |handler|
|
|
84
|
+
CLI::UI.ask('Will PPPoE be used for connection?', default: 'No') do |handler|
|
|
84
85
|
handler.option 'Yes' do
|
|
85
86
|
mtu -= 8
|
|
86
87
|
explanations << { bytes: 8, description: 'PPPoE' }
|
|
@@ -193,9 +194,21 @@ CLI::UI::Frame.open('Tunneling MTU calculator', color: :cyan) do
|
|
|
193
194
|
explanations << { bytes: hmac[:size], description: hmac[:name] }
|
|
194
195
|
end
|
|
195
196
|
end
|
|
197
|
+
|
|
198
|
+
CLI::UI.ask('Which tunneling mode is used?') do |handler|
|
|
199
|
+
handler.option 'TUN (layer 3)' do
|
|
200
|
+
explanations << { bytes: 0, description: 'TUN' }
|
|
201
|
+
end
|
|
202
|
+
handler.option 'TAP (layer 2)' do
|
|
203
|
+
explanations << { bytes: 14, description: 'TAP' }
|
|
204
|
+
end
|
|
205
|
+
end
|
|
196
206
|
end
|
|
197
207
|
handler.option('Tinc') do
|
|
198
208
|
CLI::UI.ask('Which Tinc transfer protocol do you use?') do |handler|
|
|
209
|
+
mtu -= 8
|
|
210
|
+
explanations << { bytes: 8, description: 'UDP' }
|
|
211
|
+
|
|
199
212
|
handler.option 'SFTPS (Tinc 1.1)' do
|
|
200
213
|
CLI::UI.ask('Which Tinc protocol version is used?') do |handler|
|
|
201
214
|
handler.option '17.4 or later (IF IN DOUBT, SELECT THIS)' do
|
|
@@ -212,24 +225,78 @@ CLI::UI::Frame.open('Tunneling MTU calculator', color: :cyan) do
|
|
|
212
225
|
explanations << { bytes: 21, description: 'SFTPS' }
|
|
213
226
|
end
|
|
214
227
|
handler.option 'Legacy protocol (Tinc 1.0)' do
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
228
|
+
CLI::UI.ask('Is a non-default MAC length being used?', default: 'No') do |handler|
|
|
229
|
+
handler.option 'Yes' do
|
|
230
|
+
mac_length = CLI::UI.ask('What MAC length is used?').to_i
|
|
231
|
+
mtu -= mac_length
|
|
232
|
+
explanations << { bytes: mac_length, description: 'MAC' }
|
|
233
|
+
end
|
|
234
|
+
handler.option 'No' do
|
|
235
|
+
mtu -= 4
|
|
236
|
+
explanations << { bytes: 4, description: 'MAC' }
|
|
237
|
+
end
|
|
238
|
+
end
|
|
222
239
|
|
|
223
240
|
bmtu = mtu
|
|
224
241
|
mtu = get_cbc_mtu mtu, 4
|
|
225
242
|
explanations << { bytes: bmtu - mtu, description: 'Padding' }
|
|
226
243
|
|
|
227
244
|
explanations << { bytes: 4, description: 'Sequence number' } # subtracted in get_cbc_mtu
|
|
245
|
+
|
|
246
|
+
CLI::UI.ask('Which Tinc mode is being used?') do |handler|
|
|
247
|
+
handler.option 'Router (layer 3)' do
|
|
248
|
+
explanations << { bytes: 0, description: 'Router mode' }
|
|
249
|
+
end
|
|
250
|
+
handler.option 'Switch (layer 2)' do
|
|
251
|
+
mtu -= 14
|
|
252
|
+
explanations << { bytes: 14, description: 'Switch mode' }
|
|
253
|
+
end
|
|
254
|
+
handler.option 'Hub (layer 2)' do
|
|
255
|
+
mtu -= 14
|
|
256
|
+
explanations << { bytes: 14, description: 'Hub mode' }
|
|
257
|
+
end
|
|
258
|
+
end
|
|
259
|
+
end
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
handler.option('GRE') do
|
|
263
|
+
mtu -= 4
|
|
264
|
+
explanations << { bytes: 4, description: 'GRE' }
|
|
265
|
+
|
|
266
|
+
CLI::UI.ask('Which GRE is used?') do |handler|
|
|
267
|
+
handler.option 'GRE (layer 3)' do
|
|
268
|
+
end
|
|
269
|
+
handler.option 'GRETAP (layer 2)' do
|
|
270
|
+
mtu -= 14
|
|
271
|
+
explanations << { bytes: 14, description: 'TAP' }
|
|
272
|
+
end
|
|
273
|
+
end
|
|
274
|
+
end
|
|
275
|
+
handler.option('SIT') do
|
|
276
|
+
mtu -= 0
|
|
277
|
+
explanations << { bytes: 0, description: 'SIT' }
|
|
278
|
+
end
|
|
279
|
+
handler.option('VXLAN') do
|
|
280
|
+
mtu -= 8
|
|
281
|
+
explanations << { bytes: 8, description: 'UDP' }
|
|
282
|
+
mtu -= 8
|
|
283
|
+
explanations << { bytes: 8, description: 'VXLAN' }
|
|
284
|
+
end
|
|
285
|
+
handler.option('GENEVE') do
|
|
286
|
+
mtu -= 8
|
|
287
|
+
explanations << { bytes: 8, description: 'UDP' }
|
|
288
|
+
mtu -= 8
|
|
289
|
+
explanations << { bytes: 8, description: 'GENEVE' }
|
|
290
|
+
|
|
291
|
+
CLI::UI.ask('Which layer is tunneled via GENEVE?', default: 'Ethernet (layer 2)') do |handler|
|
|
292
|
+
handler.option 'IP (layer 3)' do
|
|
293
|
+
end
|
|
294
|
+
handler.option 'Ethernet (layer 2)' do
|
|
295
|
+
mtu -= 14
|
|
296
|
+
explanations << { bytes: 14, description: 'Ethernet' }
|
|
228
297
|
end
|
|
229
298
|
end
|
|
230
299
|
end
|
|
231
|
-
# handler.option('GRE') { |selection| selection }
|
|
232
|
-
# handler.option('GRETAP') { |selection| selection }
|
|
233
300
|
end
|
|
234
301
|
|
|
235
302
|
CLI::UI::Frame.open('Overhead Breakdown', color: :blue) do
|
|
@@ -243,7 +310,7 @@ CLI::UI::Frame.open('Tunneling MTU calculator', color: :cyan) do
|
|
|
243
310
|
else
|
|
244
311
|
exp[:bytes] > 15 ? 'yellow' : 'green'
|
|
245
312
|
end
|
|
246
|
-
puts CLI::UI.fmt " {{
|
|
313
|
+
puts CLI::UI.fmt " {{bold:#{exp[:description]}:}} {{#{color}:-#{exp[:bytes]}}} Bytes"
|
|
247
314
|
end
|
|
248
315
|
end
|
|
249
316
|
|
|
@@ -259,3 +326,4 @@ CLI::UI::Frame.open('Tunneling MTU calculator', color: :cyan) do
|
|
|
259
326
|
end
|
|
260
327
|
end
|
|
261
328
|
end
|
|
329
|
+
|