| Class | Dnsruby::SingleResolver |
| In: |
lib/Dnsruby/SingleResolver.rb
|
| Parent: | Object |
The SingleResolver class targets a single resolver, and controls the sending of a single packet with a packet timeout. It performs no retries. Only two threads are used - the client thread and a select thread (which is reused across all queries).
These methods raise an exception or return a response message with rcode==NOERROR
These methods use a response queue to return the response and the error
| ignore_truncation | [RW] |
Don‘t worry if the response is truncated - return it anyway.
Defaults to false |
| packet_timeout | [RW] | |
| persistent_tcp | [RW] |
Should the TCP socket persist between queries?
Defaults to false |
| persistent_udp | [RW] |
Should the UDP socket persist between queries?
Defaults to false |
| port | [RW] |
The port on the resolver to send queries to.
Defaults to 53 |
| recurse | [RW] |
should the Recursion Desired bit be set on queries?
Defaults to true |
| server | [R] | The address of the resolver to send queries to |
| src_address | [RW] |
The source address to send queries from
Defaults to localhost |
| src_port | [RW] |
The source port to send queries from
Defaults to 0 - random port |
| tsig_key | [RW] | |
| udp_size | [RW] |
The max UDP packet size
Defaults to 512 |
| use_tcp | [RW] |
Use TCP rather than UDP as the transport.
Defaults to false |
Can take a hash with the following optional keys :
Synchronously send a query for the given name. The type will default to A, and the class to IN.
Asynchronously send a Message to the server. A client_queue is supplied by the client, along with a client_query_id to identify the response. When the response is known, the tuple (query_id, response_message, response_exception) is put in the queue for the client to process.
The query is sent synchronously in the caller‘s thread. The select thread is then used to listen for and process the response (up to pushing it to the client_queue). The client thread is then used to retrieve the response and deal with it.
Takes :
Synchronously send a Message to the server. If a valid response is returned, then that is returned to the client. Otherwise a ResolvError or ResolvTimeout will be thrown.
Takes the message to send, and an optional use_tcp parameter which defaults to SingleResolver.use_tcp