envoy-proxy 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1ceea987c2f42d998c32945dea4d25f6c571db0d
4
- data.tar.gz: 4d79c5986ad8af9578b95b00d5af917b6e04bf87
3
+ metadata.gz: 7644ebca255c042dfc7547f19bdc2eea334aedba
4
+ data.tar.gz: fcbd5085dd22d98ba09bcd78ab42ff4aa3fb9871
5
5
  SHA512:
6
- metadata.gz: 49e207baec76b7e7337a4523415a890e8ff0a9ba794bc85ac13ffa4f832b23a3c0b2999827206a82d033c1fa42f29e3bcc0b93de3a246cf5f211414a9aa7b005
7
- data.tar.gz: 3f1db159171267008e2a2572aae30d0e0766c547377da9153a283a1fbfb7c3258a21d098d03550dc45188d830ee93b68c19a095867c59c2cbf51bac1d33ef2e4
6
+ metadata.gz: 96a448f58f4fc00987428d5456af0bbb0e974a1fc5958050acb1081c01dd44a93ec1fdee189d7909f222f9eaab70b77b72ba6b88b6129522dd9680adeae7861f
7
+ data.tar.gz: 631fdb2c113848702e123b41f1d50429a789ad90e9c33b071829c6d88258c1adf547197a5fb814b60c88a0b29ca755db7b8dae5028c10ad4430e08517edb20e0
data/README.md CHANGED
@@ -6,7 +6,7 @@ A clone of proxylocal. Both client and server are included.
6
6
 
7
7
  ## The client
8
8
 
9
- envoy [--key KEY] [--host HOST] [--tls] [--server SERVER] [[ADDRESS:]PORT]
9
+ envoy [--key KEY] [--host HOST] [--tls] [--server SERVER] [--log FILE] [[ADDRESS:]PORT]
10
10
 
11
11
  Makes the HTTP* service running at ADDRESS:PORT available via a proxylocal
12
12
  service running on SERVER. The default server is p45.eu, and the default address
@@ -53,6 +53,7 @@ connection is refused.
53
53
  delay Number of seconds to wait before reconnecting, 1
54
54
  after starting a command
55
55
  dir A directory to change to None
56
+ log A file to log to /dev/stderr
56
57
 
57
58
  If no host is specified, a random one is selected by the server.
58
59
  If no local port is specified, a random one is selected by the client.
@@ -20,7 +20,7 @@ def load_config
20
20
  conf = YAML.load(File.read(path))
21
21
  conf.is_a?(Array) ? conf : [conf]
22
22
  else
23
- [{}]
23
+ [{"local_port" => "80"}]
24
24
  end
25
25
  end
26
26
 
@@ -29,8 +29,8 @@ options = parse_options
29
29
  unless EM.reactor_running?
30
30
  EM.run do
31
31
  load_config.each do |config|
32
- config["local_port"] ||= rand(16383) + 49152
33
32
  config = options.merge(config)
33
+ config["local_port"] ||= rand(16383) + 49152
34
34
  config["hosts"] ||= [config.delete("host")] if config["host"]
35
35
  config = config.each_with_object({}) do |(k, v), h|
36
36
  h[k.to_sym] = v
@@ -38,5 +38,4 @@ unless EM.reactor_running?
38
38
  Envoy::Client::Trunk.start config
39
39
  end
40
40
  end
41
- end
42
-
41
+ end
@@ -35,6 +35,12 @@ def parse_options
35
35
  op.on "-v", "--[no-]verbose", "Be noisy about what's happening" do |v|
36
36
  options["verbose"] = v
37
37
  end
38
+ op.on "--no-log", "Don't show HTTP log" do |v|
39
+ options["log"] = false
40
+ end
41
+ op.on "l", "--log FILE", "Write HTTP log to this file" do |v|
42
+ options["log"] = v
43
+ end
38
44
  op.on "-h", "--help", "Show this message" do
39
45
  puts op
40
46
  exit
@@ -15,6 +15,10 @@ module Envoy
15
15
 
16
16
  def initialize options
17
17
  @options = options
18
+ @log = STDERR
19
+ if @options.has_key?(:log)
20
+ @log = @options[:log] && File.open(@options[:log], "a")
21
+ end
18
22
  end
19
23
 
20
24
  def channels
@@ -42,9 +46,11 @@ module Envoy
42
46
  def receive_keepalive
43
47
  end
44
48
 
45
- def log message
49
+ def log message, io = @log
50
+ return unless io
46
51
  t = Time.now.strftime("%F %T")
47
- STDERR.puts t + " " + message.split("\n").join("\n#{t.gsub(/./, ' ')} ")
52
+ io.puts t + " " + message.split("\n").join("\n#{t.gsub(/./, ' ')} ")
53
+ io.flush
48
54
  end
49
55
 
50
56
  def receive_message message
@@ -30,4 +30,3 @@ module Envoy
30
30
  end
31
31
 
32
32
  end
33
-
@@ -5,6 +5,11 @@ module Envoy
5
5
  module Trunk
6
6
  include Protocol
7
7
 
8
+ def log message
9
+ t = Time.now.strftime("%F %T")
10
+ STDERR.puts t + " " + message.split("\n").join("\n#{t.gsub(/./, ' ')} ")
11
+ end
12
+
8
13
  def initialize key
9
14
  super
10
15
  @key = key
@@ -1,6 +1,3 @@
1
1
  module Envoy
2
- VERSION = '0.1.1'
3
- def version
4
- VERSION.split(".")
5
- end
2
+ VERSION = '0.1.2'
6
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: envoy-proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Baum