logs-cf-plugin 0.0.30.pre → 0.0.31.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/logs-cf-plugin/ip_lookup.rb +25 -0
- data/lib/logs-cf-plugin/loggregator_client.rb +1 -7
- data/lib/logs-cf-plugin/plugin.rb +6 -1
- metadata +5 -10
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjQ1OTkwNmMxZTU1ODM2ODNhMTcyYmJlOTZmMjQ4MGM3OWYwMmMyYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzVmMDcwOGNmOWFmN2Q0ZTg5YTAyNjI1OGMyZTI1YTVkMTc0NWZmMA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTU4NTA4MGI1Y2I1MDg2ODllZTUyYmE4YzFkMWI2OThiMzk5YTAyNTgxYzE2
|
10
|
+
OWZlODdhMTgwMzg4YTNlYTY0NTZmN2IyODkwNDJkYjhkOTg5NDU4MmRmYzdh
|
11
|
+
YTFlOTk1M2IzYzUwNzM2NWU2MTcyNjBjYTQ4MTk1N2QxMTJlYmU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
OTJjYThiODc5ZWYyNmE3ZTk4YTI0NjI0OWMzZjg3YmIxOTdlNmVkMmQ2YmM5
|
14
|
+
ODdhYTBlM2ViNjZmYzc5ZDIwZTI5NjQ5NGRmMzhmNDZjNWNiOTAxNzUyNWVi
|
15
|
+
NDliODE4NTdjYWY3YWMxMTc2MzY2NmM2MjNiZDgyMjczZmU3ZGM=
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'socket'
|
2
|
+
|
3
|
+
module IpLookup
|
4
|
+
def self.best_ip_info
|
5
|
+
ip = (my_first_public_ipv4 || my_first_private_ipv4)
|
6
|
+
ip && ip.ip_address
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def self.my_first_private_ipv4
|
12
|
+
Socket.ip_address_list.detect do |intf|
|
13
|
+
intf.ipv4_private?
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.my_first_public_ipv4
|
18
|
+
Socket.ip_address_list.detect do |intf|
|
19
|
+
intf.ipv4? and
|
20
|
+
!intf.ipv4_loopback? and
|
21
|
+
!intf.ipv4_multicast? and
|
22
|
+
!intf.ipv4_private?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -1,9 +1,3 @@
|
|
1
|
-
require 'loggregator_messages'
|
2
|
-
require 'faye/websocket'
|
3
|
-
require 'eventmachine'
|
4
|
-
require 'uri'
|
5
|
-
require 'logs-cf-plugin/message_writer'
|
6
|
-
|
7
1
|
module LogsCfPlugin
|
8
2
|
class LoggregatorClient
|
9
3
|
include CFoundry::TraceHelpers
|
@@ -21,7 +15,7 @@ module LogsCfPlugin
|
|
21
15
|
output.puts "websocket_address: #{websocket_address}" if trace
|
22
16
|
|
23
17
|
EM.run {
|
24
|
-
ws = Faye::WebSocket::Client.new(websocket_address, nil, :headers => {"Origin" =>
|
18
|
+
ws = Faye::WebSocket::Client.new(websocket_address, nil, :headers => {"Origin" => IpLookup.best_ip_info, "Authorization" => user_token})
|
25
19
|
|
26
20
|
ws.on :open do |event|
|
27
21
|
output.puts("Connected to server.")
|
@@ -1,9 +1,14 @@
|
|
1
1
|
require 'cf'
|
2
|
+
require 'eventmachine'
|
3
|
+
require 'faye/websocket'
|
4
|
+
require 'loggregator_messages'
|
5
|
+
require 'uri'
|
2
6
|
|
3
7
|
module LogsCfPlugin
|
4
|
-
require 'logs-cf-plugin/
|
8
|
+
require 'logs-cf-plugin/ip_lookup'
|
5
9
|
require 'logs-cf-plugin/log_target'
|
6
10
|
require 'logs-cf-plugin/message_writer'
|
11
|
+
require 'logs-cf-plugin/loggregator_client'
|
7
12
|
|
8
13
|
class Plugin < CF::CLI
|
9
14
|
include LoginRequirements
|
metadata
CHANGED
@@ -1,33 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logs-cf-plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.31.pre
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pivotal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-08-
|
11
|
+
date: 2013-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cf
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 4.2.5
|
20
|
-
- - <
|
17
|
+
- - ~>
|
21
18
|
- !ruby/object:Gem::Version
|
22
19
|
version: '5.0'
|
23
20
|
type: :runtime
|
24
21
|
prerelease: false
|
25
22
|
version_requirements: !ruby/object:Gem::Requirement
|
26
23
|
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 4.2.5
|
30
|
-
- - <
|
24
|
+
- - ~>
|
31
25
|
- !ruby/object:Gem::Version
|
32
26
|
version: '5.0'
|
33
27
|
- !ruby/object:Gem::Dependency
|
@@ -79,6 +73,7 @@ executables: []
|
|
79
73
|
extensions: []
|
80
74
|
extra_rdoc_files: []
|
81
75
|
files:
|
76
|
+
- lib/logs-cf-plugin/ip_lookup.rb
|
82
77
|
- lib/logs-cf-plugin/log_target.rb
|
83
78
|
- lib/logs-cf-plugin/loggregator_client.rb
|
84
79
|
- lib/logs-cf-plugin/message_writer.rb
|