envoy-proxy 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/envoy/client/command.rb +3 -4
- data/lib/envoy/client/option_parser.rb +6 -0
- data/lib/envoy/client/trunk.rb +8 -2
- data/lib/envoy/protocol.rb +0 -1
- data/lib/envoy/server/trunk.rb +5 -0
- data/lib/envoy/version.rb +1 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7644ebca255c042dfc7547f19bdc2eea334aedba
|
4
|
+
data.tar.gz: fcbd5085dd22d98ba09bcd78ab42ff4aa3fb9871
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
data/lib/envoy/client/command.rb
CHANGED
@@ -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
|
data/lib/envoy/client/trunk.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/envoy/protocol.rb
CHANGED
data/lib/envoy/server/trunk.rb
CHANGED
data/lib/envoy/version.rb
CHANGED