dns_one 0.4.24 → 0.4.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dns_one/backend/db.rb +12 -16
- data/lib/dns_one/version.rb +1 -1
- data/lib/dns_one/zone_search.rb +3 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61b79c877f92aa27ce0f2a934564dbb6dfd5081e
|
4
|
+
data.tar.gz: d1a5fa9cf4fe59d40d94a0d37a94467781a5644a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ba44dc2194fab4f8dda31969947e5589e4ea09f564df940f0548a3d6b41dc47d0cb55638f9e7ff20f5e2086e57eb0d2fa10943a1fc3d8b043e38fdf4b1112c9
|
7
|
+
data.tar.gz: a87d1bae6b44a3be9c79914aa4de83c0a09f86287a01a4b2db99cdf721ae30f4d5a356269f72207f541f5a570433f7662859fcaea34a8c11507b74d9935fbbd8
|
data/lib/dns_one/backend/db.rb
CHANGED
@@ -10,28 +10,24 @@ module DnsOne; module Backend; class DB
|
|
10
10
|
def find dom_name, tries = 1
|
11
11
|
return if tries > 3
|
12
12
|
|
13
|
-
|
13
|
+
sql = build_query dom_name
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
ActiveRecord::Base.
|
18
|
-
sql = build_query dom_name
|
19
|
-
res = ActiveRecord::Base.connection.execute sql
|
20
|
-
end
|
21
|
-
|
22
|
-
rescue ActiveRecord::StatementInvalid => e
|
23
|
-
Log.e "SQL query error. Trying to reconnect #{tries}. Details:\n#{e.desc}"
|
24
|
-
# http://geoff.evason.name/2015/01/18/postgres-ssl-connection-has-been-closed-unexpectedly
|
25
|
-
ActiveRecord::Base.connection.reconnect!
|
26
|
-
find dom_name, (tries+1)
|
27
|
-
|
28
|
-
rescue => e
|
29
|
-
Log.e "SQL query error. Details:\n#{e.desc}"
|
15
|
+
# http://jakeyesbeck.com/2016/02/14/ruby-threads-and-active-record-connections/
|
16
|
+
res = ActiveRecord::Base.connection_pool.with_connection do
|
17
|
+
ActiveRecord::Base.connection.execute sql
|
30
18
|
end
|
31
19
|
|
32
20
|
first_record = res&.first
|
33
21
|
record_values = first_record&.values
|
34
22
|
record_values&.first
|
23
|
+
|
24
|
+
rescue ActiveRecord::StatementInvalid => e
|
25
|
+
Log.e "SQL query error. Trying to reconnect #{tries}. Details:\n#{e.desc}"
|
26
|
+
# http://geoff.evason.name/2015/01/18/postgres-ssl-connection-has-been-closed-unexpectedly
|
27
|
+
ActiveRecord::Base.connection.reconnect!
|
28
|
+
find dom_name, (tries+1)
|
29
|
+
rescue => e
|
30
|
+
Log.e "SQL query error. Details:\n#{e.desc}"
|
35
31
|
end
|
36
32
|
|
37
33
|
def allow_cache
|
data/lib/dns_one/version.rb
CHANGED
data/lib/dns_one/zone_search.rb
CHANGED
@@ -6,6 +6,7 @@ require 'dns_one/backend/db'
|
|
6
6
|
module DnsOne; class ZoneSearch
|
7
7
|
include Singleton
|
8
8
|
|
9
|
+
DOM_REGEX = /^[a-z0-9]+([\-\.][a-z0-9]+)*\.[a-z]{2,6}$/i
|
9
10
|
Name = Resolv::DNS::Name
|
10
11
|
IN = Resolv::DNS::Resource::IN
|
11
12
|
|
@@ -23,6 +24,8 @@ module DnsOne; class ZoneSearch
|
|
23
24
|
end
|
24
25
|
|
25
26
|
def query dom_name, res_class, ip_address
|
27
|
+
return unless dom_name =~ DOM_REGEX
|
28
|
+
|
26
29
|
dom_name = dom_name.dup
|
27
30
|
res_class_short = Util.last_mod res_class # :A, :NS, found in conf.yml:record_sets items
|
28
31
|
Log.d "request #{ dom_name }/#{res_class_short} from #{ip_address}..."
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dns_one
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Lobato
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
155
|
version: '0'
|
156
156
|
requirements: []
|
157
157
|
rubyforge_project:
|
158
|
-
rubygems_version: 2.5.
|
158
|
+
rubygems_version: 2.5.1
|
159
159
|
signing_key:
|
160
160
|
specification_version: 4
|
161
161
|
summary: DNS server for many zones sharing only one or few records, written in Ruby.
|