Module: Async::DNS

Defined in:
lib/async/dns.rb,
lib/async/dns/cache.rb,
lib/async/dns/server.rb,
lib/async/dns/system.rb,
lib/async/dns/chunked.rb,
lib/async/dns/handler.rb,
lib/async/dns/version.rb,
lib/async/dns/endpoint.rb,
lib/async/dns/resolver.rb,
lib/async/dns/transport.rb,
lib/async/dns/transaction.rb

Overview

Released under the MIT License. Copyright, 2015-2024, by Samuel Williams. Copyright, 2023, by Hal Brodigan.

Defined Under Namespace

Modules: Endpoint, System Classes: Cache, DatagramHandler, GenericHandler, InvalidProtocolError, ResolutionFailure, Resolver, Server, StreamHandler, Transaction, Transport

Constant Summary collapse

UDP_REASONABLE_SIZE =

The maximum size of a normal DNS packet (excluding EDNS).

512
UDP_MAXIMUM_SIZE =

The maximum size of a UDP packet.

2**16
VERSION =
"1.4.1"

Class Method Summary collapse

Class Method Details

.chunked(string, chunk_size = 255) ⇒ Object

Produces an array of arrays of binary data with each sub-array a maximum of chunk_size bytes.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/async/dns/chunked.rb', line 8

def self.chunked(string, chunk_size = 255)
  chunks = []
  
  offset = 0
  while offset < string.bytesize
    chunks << string.byteslice(offset, chunk_size)
    offset += chunk_size
  end
  
  return chunks
end