envoy-proxy 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -1
- data/lib/envoy/client/channel.rb +0 -1
- data/lib/envoy/client/command.rb +3 -0
- data/lib/envoy/client/trunk.rb +6 -5
- data/lib/envoy/server/trunk.rb +22 -6
- data/lib/envoy/version.rb +1 -1
- 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: 7c5709f40d5ee7755b306039b9878a39741b7639
|
4
|
+
data.tar.gz: 391a91d1eeaf9dbb01f08582e4d3438619df8bf9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f8450d98c55022734694f34fba10255893931c890c3a0159a93a6a92f4ad49e5bc1a3d159e22b2cd8e645ac246938e80d1bdd9575f59a939bb69796fc0725ba
|
7
|
+
data.tar.gz: c726cf5ede32c1931d8b9df400d23fa1f5cde03986a51d5bafe827d39cd96b7e37de90ca963360d32a904d20ef4c6022cadca66395cf2e3c62fcfd2a397156ba
|
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
|
-
envoyc [--host HOST] [--tls] [--server SERVER] [[ADDRESS:]PORT]
|
9
|
+
envoyc [--key KEY] [--host HOST] [--tls] [--server SERVER] [[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
|
@@ -16,6 +16,9 @@ By default, the service will be available on a randomly generated domain name.
|
|
16
16
|
e.g. 4iur.p45.eu. To specify the first component of the name, use the HOST
|
17
17
|
argument.
|
18
18
|
|
19
|
+
You can connect multiple clients to the same host name. To help prevent abuse,
|
20
|
+
each client must present the KEY.
|
21
|
+
|
19
22
|
## The server
|
20
23
|
|
21
24
|
envoys [--listen [HOST:]PORT] ZONE
|
data/lib/envoy/client/channel.rb
CHANGED
data/lib/envoy/client/command.rb
CHANGED
data/lib/envoy/client/trunk.rb
CHANGED
@@ -48,11 +48,14 @@ module Envoy
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def receive_halt
|
51
|
+
@halting = true
|
51
52
|
EventMachine.stop_event_loop
|
52
53
|
end
|
53
54
|
|
54
55
|
def unbind
|
55
|
-
if
|
56
|
+
if @halting
|
57
|
+
STDERR.puts "Server shut us down."
|
58
|
+
elsif !@halting && r = @options[:reconnect]
|
56
59
|
STDERR.write "Lost connection. Retrying... #{r[0]}\r"
|
57
60
|
EM.add_timer 0.5 do
|
58
61
|
@options[:reconnect] = r.rotate
|
@@ -64,16 +67,14 @@ module Envoy
|
|
64
67
|
else
|
65
68
|
STDERR.puts "Couldn't connect. Abandoning ship."
|
66
69
|
end
|
67
|
-
|
70
|
+
EventMachine.stop_event_loop
|
68
71
|
end
|
69
72
|
end
|
70
73
|
|
71
74
|
def ssl_handshake_completed
|
72
75
|
options[:did_connect] = true
|
73
76
|
options[:reconnect] = %w"- \\ | /" if options[:hosts]
|
74
|
-
|
75
|
-
o.delete(:local_host)
|
76
|
-
send_object :options, o
|
77
|
+
send_object :options, options
|
77
78
|
end
|
78
79
|
|
79
80
|
def post_init
|
data/lib/envoy/server/trunk.rb
CHANGED
@@ -33,25 +33,41 @@ module Envoy
|
|
33
33
|
channels[id].web.send_data data
|
34
34
|
end
|
35
35
|
|
36
|
+
def key
|
37
|
+
@options[:key]
|
38
|
+
end
|
39
|
+
|
40
|
+
def halt
|
41
|
+
send_object :halt
|
42
|
+
close_connection(true)
|
43
|
+
end
|
44
|
+
|
36
45
|
def receive_options options
|
37
46
|
@options = options
|
38
47
|
hosts = @options[:hosts] || []
|
39
|
-
hosts.
|
48
|
+
hosts.any? do |label|
|
40
49
|
if label == "s"
|
41
|
-
send_object :message, "
|
50
|
+
send_object :message, "#{label}: label is reserved"
|
42
51
|
true
|
43
52
|
elsif label =~ /\./
|
44
|
-
send_object :message, "labels may not contain dots"
|
53
|
+
send_object :message, "#{label}: labels may not contain dots"
|
45
54
|
true
|
55
|
+
elsif other_trunk = Trunk.trunks[label][0]
|
56
|
+
unless other_trunk.key == key
|
57
|
+
send_object :message, "#{label}: label in use, and you don't have the key"
|
58
|
+
true
|
59
|
+
end
|
46
60
|
end
|
47
|
-
end
|
61
|
+
end && halt
|
48
62
|
hosts << SecureRandom.random_number(36 ** 4).to_s(36) if hosts.empty?
|
49
|
-
m = ["
|
63
|
+
m = ["#{options[:local_host]}:#{options[:local_port]} now available at:"]
|
50
64
|
@hosts = hosts.each do |host|
|
51
65
|
Trunk.trunks[host] << self
|
52
66
|
m << "http://#{host}.#{$zone}/"
|
53
67
|
end
|
54
|
-
|
68
|
+
@options[:key] ||= SecureRandom.hex(8)
|
69
|
+
send_object :message, m.join(" ")
|
70
|
+
send_object :message, "Your key is #{@options[:key]}"
|
55
71
|
end
|
56
72
|
|
57
73
|
def unbind
|
data/lib/envoy/version.rb
CHANGED