ractor_dns 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +39 -3
- data/lib/ractor_dns/active_zone.rb +1 -1
- data/lib/ractor_dns/server.rb +2 -2
- data/lib/ractor_dns/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f04318c7ff68a828b56c907c840838eaf2db6bc713af5954d200a490a1fba78
|
4
|
+
data.tar.gz: 3d63843ff098ab3de850f6a382b8b751045587c1e73001e939ccdb8abac09fdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5890c21087d4bfb40e99f6aad33b8e86bb3074ca2db3fd9eec968e7e6930b1dd60d96bad037a9c96a95a1faeb42e8e76b95f7231613bb3783254485c5d2241fc
|
7
|
+
data.tar.gz: 9c0536c6a6910ac3ad69b56bda6740cbf372e186abf86b8164d832aa9314443f1afc0f9c18f196ae9712bd05a42983e58c962534fdd31aa85592fc13e8e7849d
|
data/README.md
CHANGED
@@ -6,15 +6,51 @@ RactorDNS is a work-in-progress concurrent DNS server built with Ruby 3.0 Ractor
|
|
6
6
|
|
7
7
|
Install the gem and add to the application's Gemfile by executing:
|
8
8
|
|
9
|
-
|
9
|
+
```bash
|
10
|
+
bundle add ractor_dns
|
11
|
+
```
|
10
12
|
|
11
13
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
12
14
|
|
13
|
-
|
15
|
+
```bash
|
16
|
+
gem install ractor_dns
|
17
|
+
```
|
14
18
|
|
15
19
|
## Usage
|
16
20
|
|
17
|
-
|
21
|
+
### Creating a server
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
server = RactorDNS::Server.new(
|
25
|
+
port: 8053,
|
26
|
+
authority: ["ns.ractordns.local", 300, RRs::IN::A.new("1.1.1.1")],
|
27
|
+
cpu_count: 12,
|
28
|
+
zones: {
|
29
|
+
"google.com" => [
|
30
|
+
{
|
31
|
+
name: "google.com",
|
32
|
+
ttl: 300,
|
33
|
+
rr: RRs::IN::A.new("8.8.8.8")
|
34
|
+
},
|
35
|
+
{
|
36
|
+
name: "test.google.com",
|
37
|
+
ttl: 300,
|
38
|
+
rr: RRs::IN::A.new("1.1.1.1")
|
39
|
+
}
|
40
|
+
]
|
41
|
+
}
|
42
|
+
)
|
43
|
+
```
|
44
|
+
|
45
|
+
### Updating zones
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
transaction = RactorDNS::Transaction.new do |zones|
|
49
|
+
zones["google.com"][0][:rr] = RRs::IN::A.new("2.2.2.2")
|
50
|
+
end
|
51
|
+
|
52
|
+
server.zones.transact transaction
|
53
|
+
```
|
18
54
|
|
19
55
|
## Development
|
20
56
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class RactorDNS::ActiveZone
|
2
2
|
attr_accessor :server
|
3
|
-
def initialize(name: "ns.ractordns.local", ttl: 300, ip: "0.0.0.0", server: nil, port:
|
3
|
+
def initialize(name: "ns.ractordns.local", ttl: 300, ip: "0.0.0.0", server: nil, port: 8053, cpu_count: 8, zones:)
|
4
4
|
@server = server.presence || RactorDNS::Server.new(
|
5
5
|
port:,
|
6
6
|
authority: [name, ttl, RRs::IN::A.new(ip)],
|
data/lib/ractor_dns/server.rb
CHANGED
@@ -2,10 +2,10 @@ module RactorDNS
|
|
2
2
|
class Server
|
3
3
|
attr_reader :authority, :ractor, :zones, :cpu_count, :port
|
4
4
|
|
5
|
-
def initialize(authority:, cpu_count:, zones:, port:
|
5
|
+
def initialize(authority:, cpu_count:, zones:, port: 8053)
|
6
6
|
@authority = authority
|
7
7
|
@cpu_count = cpu_count
|
8
|
-
@zones = zones
|
8
|
+
@zones = ZoneCollection.new(zones)
|
9
9
|
@port = port
|
10
10
|
end
|
11
11
|
|
data/lib/ractor_dns/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ractor_dns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- reesericci
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|