Skip to content

Commit fe03d54

Browse files
authored
Merge pull request ipfs#126 from ipfs/feat/custom-resolver
add custom DNS Resolver configuration
2 parents 249481b + 70a7fbe commit fe03d54

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

config/config.go

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ type Config struct {
2828
AutoNAT AutoNATConfig
2929
Pubsub PubsubConfig
3030
Peering Peering
31+
DNS DNS
3132

3233
Provider Provider
3334
Reprovider Reprovider

config/dns.go

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package config
2+
3+
// DNS specifies DNS resolution rules using custom resolvers
4+
type DNS struct {
5+
// Resolvers is a map of FQDNs to URLs for custom DNS resolution.
6+
// URLs starting with `https://` indicate DoH endpoints.
7+
// Support for other resolver types can be added in the future.
8+
// https://en.wikipedia.org/wiki/Fully_qualified_domain_name
9+
// https://en.wikipedia.org/wiki/DNS_over_HTTPS
10+
//
11+
// Example:
12+
// - Custom resolver for ENS: `eth.` → `https://eth.link/dns-query`
13+
// - Override the default OS resolver: `.` → `https://doh.applied-privacy.net/query`
14+
Resolvers map[string]string
15+
}

config/init.go

+3
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ func InitWithIdentity(identity Identity) (*Config, error) {
8989
Pinning: Pinning{
9090
RemoteServices: map[string]RemotePinningService{},
9191
},
92+
DNS: DNS{
93+
Resolvers: map[string]string{},
94+
},
9295
}
9396

9497
return conf, nil

0 commit comments

Comments
 (0)