Skip to content

Commit 231d5a3

Browse files
committed
docs: Corefile.local-dev
documenting how to get started locally, saving an hour figuring it out
1 parent 54115de commit 231d5a3

File tree

4 files changed

+30
-3
lines changed

4 files changed

+30
-3
lines changed

.dockerignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
Corefile
2+
Corefile.local-dev
23
zones
34
p2p-forge
45
p2p-forge-certs/
56
badger.libp2p-direct-challenges/
7+
registration_libp2p_direct-certs/

Corefile

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# this file demonstrates reference production settings.
2+
# for local development use: ./p2p-forge -conf Corefile.local-dev
13
libp2p.direct {
24
log
35
errors

Corefile.local-dev

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# for local development on ports 5354 (dns) and 5380 (http)
2+
# run with: ./p2p-forge -conf Corefile.local-dev -dns.port 5354
3+
libp2p.direct {
4+
log
5+
errors
6+
any # RFC 8482
7+
prometheus localhost:9253
8+
ipparser libp2p.direct
9+
file zones/libp2p.direct
10+
acme libp2p.direct {
11+
registration-domain registration.libp2p.direct listen-address=:5380 external-tls=true
12+
database-type badger badger.libp2p-direct-challenges
13+
}
14+
}

README.md

+12-3
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,26 @@ Will download using go mod, build and install the binary in your global Go binar
9696

9797
### Local testing
9898

99-
Build and run a custom Corefile configuration and on custom port:
99+
Build and run a custom Corefile configuration and on custom ports (DNS port set to `5354` via CLI, HTTP port set to `5380` via custom Corefile):
100100

101101
```console
102-
$ ./p2p-forge -conf Corefile.example -dns.port 5353
102+
$ ./p2p-forge -conf Corefile.local-dev -dns.port 5354
103103
```
104104

105105
Test with `dig`:
106106

107107
```console
108-
$ dig A 1-2-3-4.k51qzi5uqu5dlwfht6wwy7lp4z35bgytksvp5sg53fdhcocmirjepowgifkxqd.libp2p.direct @localhost -p 5353
108+
$ dig A 1-2-3-4.k51qzi5uqu5dlwfht6wwy7lp4z35bgytksvp5sg53fdhcocmirjepowgifkxqd.libp2p.direct @localhost -p 5354
109109
1.2.3.4
110+
111+
$ curl http://localhost:5380/v1/health -I
112+
HTTP/1.1 204 No Content
113+
```
114+
115+
To run on port `53` as non-root user, adjust permission:
116+
117+
```console
118+
$ sudo setcap cap_net_bind_service=+ep /path/to/p2p-forge
110119
```
111120

112121
### Docker

0 commit comments

Comments
 (0)