exposer 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +17 -0
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +44 -0
- data/Rakefile +6 -0
- data/bin/exposer +29 -0
- data/exposer.gemspec +26 -0
- data/lib/exposer.rb +54 -0
- data/lib/exposer/hash.rb +5 -0
- data/lib/exposer/version.rb +3 -0
- data/spec/expose_spec.rb +8 -0
- data/spec/spec_helper.rb +2 -0
- metadata +119 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
OGNkMjYwN2MwMDBhODg1M2NmYTlhYmQxNDQ4MTc2ZWFmZTgwM2M4ZA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YWJmNmQ5ODRkYzYxNGRmZjc3NjNmYWUzZTdkMTE1YjMxNWU0NjQ5Nw==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YjVlMmIxOTRhNTBlMTFmN2QzYjk4NmUzMmY0ODljZTNhNDRlYmZlNzcwMzYw
|
10
|
+
MTUwNTY3YmQzMzBlYzU5MTViNjBkOGVmYTM5ODZlMDkyMzViOTdjNDIwNjY3
|
11
|
+
ZjVjZmMzYjg5N2RlNzMzM2I4MzY2YjAyMTNhYmYwOWZmM2ZkZWQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZjM1Mjk1MWIyMzc4ZmE0ZGRjMmFmMDRlMmQ5Yzc5MmMyNzVmNzFlMTdiOGIy
|
14
|
+
YjA5NGZjMGVlMzJmMmM4NWRjMmNlMDk1YmUzZGZkZDZkYWFmYmRlZTgwMmUw
|
15
|
+
N2VjZmMxMmMyZTk0NjY1OWNmMjkzMGNiNjhhODRiNDNhNjE5MDI=
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Kristof Vannotten
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Exposer
|
2
|
+
|
3
|
+
Exposer exposes your services to the internet via a combination of smart ssh remote port forwarding and reverse nginx proxying.
|
4
|
+
|
5
|
+
What this means is that you can just spawn a service, tell exposer what port it runs on, on your local machine, and Exposer will
|
6
|
+
give you an URL where your service will be accessible for the entire internet to see (or at least those who know the URL)
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Install exposer:
|
11
|
+
|
12
|
+
$ gem install exposer
|
13
|
+
|
14
|
+
## Usage
|
15
|
+
|
16
|
+
After you have installed exposer you can simply start it as follows:
|
17
|
+
|
18
|
+
$ exposer -p <PORT>
|
19
|
+
|
20
|
+
Where <PORT> is the port you wish to expose. For example, if you are
|
21
|
+
creating a ruby web application, and you do a rackup, which starts a webservice at
|
22
|
+
port 9292, then you would do:
|
23
|
+
|
24
|
+
$ exposer -p 9292
|
25
|
+
|
26
|
+
You would get a response that is similar to the following:
|
27
|
+
|
28
|
+
```
|
29
|
+
Starting connection...
|
30
|
+
You can reach your service on http://yo9q.exposer.io
|
31
|
+
|
32
|
+
Press CTRL+C to stop the connection.
|
33
|
+
```
|
34
|
+
|
35
|
+
You can then just share the link that is given to you in the response. And via that link people can reach
|
36
|
+
the application that you just have set up! It's almost magic!
|
37
|
+
|
38
|
+
## Contributing
|
39
|
+
|
40
|
+
1. Fork it
|
41
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
42
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
43
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
44
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bin/exposer
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'exposer'
|
4
|
+
require 'optparse'
|
5
|
+
|
6
|
+
trap("SIGINT") { puts "\nExiting...\n"; exit! }
|
7
|
+
|
8
|
+
port = 0
|
9
|
+
|
10
|
+
options = OptionParser.new do |o|
|
11
|
+
o.banner = "Usage: exposer -p <port>\n\n"
|
12
|
+
|
13
|
+
o.on("-p", "--port PORT", "expose a port to the internet") do |p|
|
14
|
+
port = p.to_i
|
15
|
+
end
|
16
|
+
|
17
|
+
o.on('-h', "--help", "show this help") { puts o; exit }
|
18
|
+
end
|
19
|
+
|
20
|
+
args = options.parse!
|
21
|
+
unless port.between?(1, 65535)
|
22
|
+
puts options
|
23
|
+
exit
|
24
|
+
end
|
25
|
+
|
26
|
+
#fork(`ssh -fqNR expose.exposer.io:8080:localhost:9393 exposer@expose.exposer.io`)
|
27
|
+
|
28
|
+
Exposer.prepare
|
29
|
+
Exposer.start({ :port => port.to_i })
|
data/exposer.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'exposer/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "exposer"
|
8
|
+
spec.version = Exposer::VERSION
|
9
|
+
spec.authors = ["Kristof Vannotten"]
|
10
|
+
spec.email = ["kristof@vannotten.be"]
|
11
|
+
spec.description = %q{Exposer is an application that allows the user to show a locally run website over the internet to other users.}
|
12
|
+
spec.summary = %q{Exposer is an application that allows the user to show a locally run website over the internet to other users.}
|
13
|
+
spec.homepage = "https://github.com/kvannotten/exposer"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec"
|
24
|
+
|
25
|
+
spec.add_dependency "net-ssh"
|
26
|
+
end
|
data/lib/exposer.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require "exposer/version"
|
2
|
+
require "exposer/hash"
|
3
|
+
require "net/http"
|
4
|
+
require 'net/ssh'
|
5
|
+
require "json"
|
6
|
+
require 'fileutils'
|
7
|
+
module Exposer
|
8
|
+
|
9
|
+
def self.prepare
|
10
|
+
Exposer.make_sure_has_key
|
11
|
+
|
12
|
+
url = URI.parse("http://www.exposer.io/host")
|
13
|
+
@response = JSON.parse(Net::HTTP.get(url))
|
14
|
+
|
15
|
+
raise "An exception occurred: #{@response.error}" if @response.member? 'error'
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.start options = {}
|
19
|
+
raise "You need to prepare the tunnel first" if @response.nil?
|
20
|
+
|
21
|
+
begin
|
22
|
+
puts "Starting connection..."
|
23
|
+
puts "#{@response.message}" if @response.member? 'message'
|
24
|
+
|
25
|
+
Net::SSH.start("expose.exposer.io", "exposer") do |ssh|
|
26
|
+
ssh.forward.remote(options.port.to_i, "localhost", @response.port.to_i, "0.0.0.0")
|
27
|
+
puts "You can reach your service on #{@response.host}\n\n"
|
28
|
+
puts "Press CTRL+C to stop the connection."
|
29
|
+
ssh.loop { true }
|
30
|
+
end
|
31
|
+
rescue
|
32
|
+
raise "An error occurred while creating the tunnel, please try again later."
|
33
|
+
exit!
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.make_sure_has_key
|
38
|
+
if not File.exists? File.expand_path("~/.exposer") then
|
39
|
+
if not File.exists? File.expand_path("~/.ssh/id_rsa.pub") then
|
40
|
+
raise "Could not find public key in ~/.ssh/id_rsa.pub"
|
41
|
+
exit!
|
42
|
+
else
|
43
|
+
key = IO.read(File.expand_path("~/.ssh/id_rsa.pub"))
|
44
|
+
response = JSON.parse(Net::HTTP.post_form(URI.parse("http://www.exposer.io/key"), { :key => key }).body)
|
45
|
+
if response.member? "error" then
|
46
|
+
raise "An error occurred while processing your public key: #{response.error}"
|
47
|
+
exit!
|
48
|
+
end
|
49
|
+
File.open(File.expand_path("~/.exposer"), "w") { |f| f.write "1" }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
data/lib/exposer/hash.rb
ADDED
data/spec/expose_spec.rb
ADDED
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,119 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: exposer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Kristof Vannotten
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-07-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: net-ssh
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Exposer is an application that allows the user to show a locally run
|
70
|
+
website over the internet to other users.
|
71
|
+
email:
|
72
|
+
- kristof@vannotten.be
|
73
|
+
executables:
|
74
|
+
- exposer
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- .gitignore
|
79
|
+
- .rspec
|
80
|
+
- .travis.yml
|
81
|
+
- Gemfile
|
82
|
+
- LICENSE
|
83
|
+
- README.md
|
84
|
+
- Rakefile
|
85
|
+
- bin/exposer
|
86
|
+
- exposer.gemspec
|
87
|
+
- lib/exposer.rb
|
88
|
+
- lib/exposer/hash.rb
|
89
|
+
- lib/exposer/version.rb
|
90
|
+
- spec/expose_spec.rb
|
91
|
+
- spec/spec_helper.rb
|
92
|
+
homepage: https://github.com/kvannotten/exposer
|
93
|
+
licenses:
|
94
|
+
- MIT
|
95
|
+
metadata: {}
|
96
|
+
post_install_message:
|
97
|
+
rdoc_options: []
|
98
|
+
require_paths:
|
99
|
+
- lib
|
100
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ! '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
requirements: []
|
111
|
+
rubyforge_project:
|
112
|
+
rubygems_version: 2.0.5
|
113
|
+
signing_key:
|
114
|
+
specification_version: 4
|
115
|
+
summary: Exposer is an application that allows the user to show a locally run website
|
116
|
+
over the internet to other users.
|
117
|
+
test_files:
|
118
|
+
- spec/expose_spec.rb
|
119
|
+
- spec/spec_helper.rb
|