masquito 1.0.1 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/masquito.erb +0 -1
- data/lib/masquito/dns.rb +2 -2
- data/lib/masquito/install.rb +8 -3
- data/lib/masquito/settings.rb +1 -1
- data/lib/masquito/version.rb +1 -1
- data/lib/masquito.rb +3 -3
- data/masquito.gemspec +2 -0
- data/test/dns_test.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10d01491a5d517a67884d816e177870592f4b9a1
|
4
|
+
data.tar.gz: e9aa4089332f7948e84ee93d358e7c6dc856cff4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 106f4fd5b3f2741265bceb1021c8c4813d6235f956df46ce441592a513c2ca384becd690725d9d494a03b5ec45d913ef3dd7dd45aaa177f2fcf83a6113fe453a
|
7
|
+
data.tar.gz: ba2ff985b9504500ea9073be2311b0dfe5169059e3663115f8f0c4ee2bac6b22f460baf95281e785a422fe5f49adb79b2053252d5a41bb3cb5910d1ff2b24b1c
|
data/config/masquito.erb
CHANGED
data/lib/masquito/dns.rb
CHANGED
@@ -12,9 +12,9 @@ module Masquito
|
|
12
12
|
}
|
13
13
|
@@ttl = 10800 # 3 hours
|
14
14
|
|
15
|
-
def initialize(addr = ADDRESS, port = PORT,
|
15
|
+
def initialize(addr = ADDRESS, port = PORT, settings = Settings.new)
|
16
16
|
puts "Starting Masquito on #{addr}:#{port}"
|
17
|
-
@settings =
|
17
|
+
@settings = settings
|
18
18
|
|
19
19
|
# Bind port to receive requests
|
20
20
|
socket = UDPSocket.new
|
data/lib/masquito/install.rb
CHANGED
@@ -2,6 +2,7 @@ require 'erb'
|
|
2
2
|
require 'fileutils'
|
3
3
|
require 'lunchy'
|
4
4
|
require 'tempfile'
|
5
|
+
require 'pathname'
|
5
6
|
|
6
7
|
module Masquito
|
7
8
|
GEM_PATH = File.expand_path('../../../', __FILE__)
|
@@ -10,7 +11,7 @@ module Masquito
|
|
10
11
|
SERVICE_NAME = File.basename(PLIST_NAME, '.plist')
|
11
12
|
|
12
13
|
RESOLVER_TEMPLATE_PATH = File.join(GEM_PATH, 'config', 'masquito.erb')
|
13
|
-
|
14
|
+
RESOLVERS_PATH = Pathname.new('/etc/resolver')
|
14
15
|
|
15
16
|
module Install
|
16
17
|
class << self
|
@@ -43,12 +44,16 @@ module Masquito
|
|
43
44
|
abort_unless_superuser
|
44
45
|
resolver = ERB.new(File.read(RESOLVER_TEMPLATE_PATH))
|
45
46
|
template = resolver.result(binding)
|
46
|
-
|
47
|
+
Masquito::Settings.new.domains.each do |domain|
|
48
|
+
File.open(RESOLVERS_PATH.join(domain.to_s), 'w') { |f| f.write(template) }
|
49
|
+
end
|
47
50
|
end
|
48
51
|
|
49
52
|
def resolver_uninstall
|
50
53
|
abort_unless_superuser
|
51
|
-
|
54
|
+
Masquito::Settings.new.domains.each do |domain|
|
55
|
+
FileUtils.rm_rf(RESOLVERS_PATH.join(domain.to_s))
|
56
|
+
end
|
52
57
|
end
|
53
58
|
|
54
59
|
private
|
data/lib/masquito/settings.rb
CHANGED
data/lib/masquito/version.rb
CHANGED
data/lib/masquito.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module Masquito
|
2
2
|
CONFIG_PATH = File.join(ENV['HOME'], '.masquito')
|
3
3
|
|
4
|
-
autoload :DNS,
|
4
|
+
autoload :DNS, 'masquito/dns'
|
5
5
|
autoload :Settings, 'masquito/settings'
|
6
|
-
autoload :Install,
|
7
|
-
autoload :VERSION,
|
6
|
+
autoload :Install, 'masquito/install'
|
7
|
+
autoload :VERSION, 'masquito/version'
|
8
8
|
end
|
data/masquito.gemspec
CHANGED
data/test/dns_test.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: masquito
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmitry Vorotilin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-11-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: lunchy
|
@@ -25,6 +25,20 @@ dependencies:
|
|
25
25
|
- - '>='
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rake
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
28
42
|
description: Masquito is a dns masquerading server for rubists
|
29
43
|
email:
|
30
44
|
- d.vorotilin@gmail.com
|
@@ -78,3 +92,4 @@ test_files:
|
|
78
92
|
- test/dns_test.rb
|
79
93
|
- test/settings_test.rb
|
80
94
|
- test/test_helper.rb
|
95
|
+
has_rdoc:
|