Class: Rex::Proto::DNS::UpstreamResolver
- Inherits:
-
Object
- Object
- Rex::Proto::DNS::UpstreamResolver
- Defined in:
- lib/rex/proto/dns/upstream_resolver.rb
Overview
This represents a single upstream DNS resolver target of one of the predefined types.
Defined Under Namespace
Modules: Type
Instance Attribute Summary collapse
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#socket_options ⇒ Object
readonly
Returns the value of attribute socket_options.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
-
.create_black_hole ⇒ Object
Initialize a new black-hole resolver.
-
.create_dns_server(destination, socket_options: {}) ⇒ Object
Initialize a new dns-server resolver.
-
.create_static ⇒ Object
Initialize a new static resolver.
-
.create_system ⇒ Object
Initialize a new system resolver.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
-
#initialize(type, destination: nil, socket_options: {}) ⇒ UpstreamResolver
constructor
A new instance of UpstreamResolver.
- #to_s ⇒ Object
Constructor Details
#initialize(type, destination: nil, socket_options: {}) ⇒ UpstreamResolver
Returns a new instance of UpstreamResolver.
23 24 25 26 27 |
# File 'lib/rex/proto/dns/upstream_resolver.rb', line 23 def initialize(type, destination: nil, socket_options: {}) @type = type @destination = destination @socket_options = end |
Instance Attribute Details
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
17 18 19 |
# File 'lib/rex/proto/dns/upstream_resolver.rb', line 17 def destination @destination end |
#socket_options ⇒ Object (readonly)
Returns the value of attribute socket_options.
17 18 19 |
# File 'lib/rex/proto/dns/upstream_resolver.rb', line 17 def @socket_options end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
17 18 19 |
# File 'lib/rex/proto/dns/upstream_resolver.rb', line 17 def type @type end |
Class Method Details
.create_black_hole ⇒ Object
Initialize a new black-hole resolver.
30 31 32 |
# File 'lib/rex/proto/dns/upstream_resolver.rb', line 30 def self.create_black_hole self.new(Type::BLACK_HOLE) end |
.create_dns_server(destination, socket_options: {}) ⇒ Object
Initialize a new dns-server resolver.
38 39 40 41 42 43 44 |
# File 'lib/rex/proto/dns/upstream_resolver.rb', line 38 def self.create_dns_server(destination, socket_options: {}) self.new( Type::DNS_SERVER, destination: destination, socket_options: ) end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
64 65 66 67 68 69 70 |
# File 'lib/rex/proto/dns/upstream_resolver.rb', line 64 def eql?(other) return false unless other.is_a?(self.class) return false unless other.type == type return false unless other.destination == destination return false unless other. == true end |
#to_s ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/rex/proto/dns/upstream_resolver.rb', line 56 def to_s if type == Type::DNS_SERVER destination.to_s else type.to_s end end |