dns_one 0.5.3 → 0.5.4
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/server.rb +28 -24
- data/lib/dns_one/util.rb +11 -10
- data/lib/dns_one/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: dafa640dc8815562ed27e6f49e9b0b5154f90673
|
4
|
+
data.tar.gz: 1544acf2162fffcc5d7bdb5b4a04cdeee96f1a5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a21555de7c3c263252ba6d8566535202fbc318010b8b4e22a6f41ceaee815f90999d6569b9df31277f987b4b31536c3d5d43276b3601bc5dc2f111c5e60a8829
|
7
|
+
data.tar.gz: f727d926263b706b1fae79b739ab3599357764443b16df3e025c93c701a33a816492e14f7b74011a10d2278767601536109d49d615bdeb2ca7e8d2ce22a8b15a
|
data/lib/dns_one/server.rb
CHANGED
@@ -73,32 +73,36 @@ module DnsOne; class Server
|
|
73
73
|
rcode = :ServFail
|
74
74
|
end
|
75
75
|
|
76
|
-
|
77
|
-
|
78
|
-
|
76
|
+
begin
|
77
|
+
if conf[:save_stats]
|
78
|
+
stat.save rcode, t.resource_class, from_cache
|
79
|
+
end
|
79
80
|
|
80
|
-
|
81
|
-
|
82
|
-
|
81
|
+
if conf[:log_result]
|
82
|
+
Util.log_result ip_address, domain_name, t.resource_class, rcode, resp_log, from_cache
|
83
|
+
end
|
83
84
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
85
|
+
if conf[:log_result_socket]
|
86
|
+
log_result_mutex.synchronize {
|
87
|
+
log_result[:requests] ||= 0
|
88
|
+
log_result[:requests] += 1
|
89
|
+
|
90
|
+
log_result[:cache] ||= 0
|
91
|
+
log_result[:cache] += 1 if from_cache
|
92
|
+
|
93
|
+
rcode_uc = Util.const_underscore rcode
|
94
|
+
log_result[:rcode] ||= {}
|
95
|
+
log_result[:rcode][rcode_uc] ||= 0
|
96
|
+
log_result[:rcode][rcode_uc] += 1
|
97
|
+
|
98
|
+
req_resource = Util.last_mod(t.resource_class).downcase
|
99
|
+
log_result[:req_resource] ||= {}
|
100
|
+
log_result[:req_resource][req_resource] ||= 0
|
101
|
+
log_result[:req_resource][req_resource] += 1
|
102
|
+
}
|
103
|
+
end
|
104
|
+
rescue => e
|
105
|
+
Log.exc e
|
102
106
|
end
|
103
107
|
|
104
108
|
raise e if e
|
data/lib/dns_one/util.rb
CHANGED
@@ -51,16 +51,17 @@ module DnsOne; class Util
|
|
51
51
|
|
52
52
|
Log.i "result: #{ fields.join ' ' }"
|
53
53
|
end
|
54
|
-
end
|
55
54
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
55
|
+
def const_underscore name
|
56
|
+
name = name.to_s.dup
|
57
|
+
name.gsub!('::', '/')
|
58
|
+
name.gsub!(/([A-Z\d]+)([A-Z][a-z])/,'\1_\2')
|
59
|
+
name.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
|
60
|
+
name.tr!("-", "_")
|
61
|
+
name.downcase!
|
62
|
+
name
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
65
66
|
|
66
67
|
end; end
|
data/lib/dns_one/version.rb
CHANGED