log-courier 2.7.0 → 2.7.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/log-courier/protocol.rb +58 -0
  3. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eeea3f53b4849932879f09791e5f0f842e210546916797791c89426bcbffff61
4
- data.tar.gz: 8c0d77a0dfd6dbc1b48e511dee3ff8d91954f33610ddaebbcc64cf07fbd02f79
3
+ metadata.gz: a3ef8d232349a4aeaabfab1481b1675ccd57fa9e10b965d87d7824c23d6f7791
4
+ data.tar.gz: 64942e87ac4da08392b7f48bdf0170914617696bebf41a3cb21a87596f8506b8
5
5
  SHA512:
6
- metadata.gz: f4c1a27c6024bf6787bd56f60b2af15a0518e4ba250dcb1b3ff7da70ffe961006cff3c4bc6d0595dea0af43307a652457d8c6d715b765b88c1641250d8e327b5
7
- data.tar.gz: 9c83a0e1f3bdf516bab3917ccaea04e33bb1ee8902708820cad651ed905be765e84b120da79798cc68ffe2f5b2a8f03fac0c7193b3179b13e9b4c251a0a78636
6
+ metadata.gz: e38df8efda4dcf97cac9bfee072c2c8dc46a4af6a4ee09233c0cc5562b3ee389f8e99b9ecbbdf3347f42bd498c44bf649ddfb86676ddd5e1ebd4db0cf4be1a94
7
+ data.tar.gz: fef73ad4bbc70488a2d6dbed07ae5c0ba3ec89c42806fa836ab25781ea995e5fd2783dbaf1b0f483a6c528da0f2f8e0dd2c3fd97668e94dd6827d1f128de3f8e
@@ -0,0 +1,58 @@
1
+ # Copyright 2014-2021 Jason Woods and Contributors.
2
+ #
3
+ # This file is a modification of code from Ruby.
4
+ # Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+
18
+ #
19
+ # Name calculation from HELO/VERS
20
+ #
21
+ module LogCourier
22
+ # Protocol
23
+ module Protocol
24
+ def self.parse_helo_vers(data)
25
+ data = "\x00\x00\x00\x00\x00\x00\x00\x00" if data.length < 8
26
+
27
+ flags, major_version, minor_version, patch_version, client = data.unpack('CCCCA4')
28
+ client = case client
29
+ when 'LCOR'
30
+ 'Log Courier'
31
+ when 'LCVR'
32
+ 'Log Carver'
33
+ when 'RYLC'
34
+ 'Ruby Log Courier'
35
+ else
36
+ 'Unknown'
37
+ end
38
+
39
+ if major_version != 0 || minor_version != 0 || patch_version != 0
40
+ version = "#{major_version}.#{minor_version}.#{patch_version}"
41
+ client_version = "#{client} v#{version}"
42
+ else
43
+ version = ''
44
+ client_version = client
45
+ end
46
+
47
+ {
48
+ flags: flags,
49
+ major_version: major_version,
50
+ minor_version: minor_version,
51
+ patch_version: patch_version,
52
+ client: client,
53
+ version: version,
54
+ client_version: client_version,
55
+ }
56
+ end
57
+ end
58
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: log-courier
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.0
4
+ version: 2.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Woods
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-20 00:00:00.000000000 Z
11
+ date: 2021-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -48,6 +48,7 @@ files:
48
48
  - lib/log-courier/client.rb
49
49
  - lib/log-courier/client_tcp.rb
50
50
  - lib/log-courier/event_queue.rb
51
+ - lib/log-courier/protocol.rb
51
52
  - lib/log-courier/server.rb
52
53
  - lib/log-courier/server_tcp.rb
53
54
  homepage: https://github.com/driskell/ruby-log-courier