Skip to content

Commit

Permalink
go-ipfs-config: Merge pull request ipfs#126 from ipfs/feat/custom-res…
Browse files Browse the repository at this point in the history
…olver

add custom DNS Resolver configuration
  • Loading branch information
vyzo authored Apr 15, 2021
2 parents bb16493 + 7bc2d44 commit a7702d2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ type Config struct {
AutoNAT AutoNATConfig
Pubsub PubsubConfig
Peering Peering
DNS DNS

Provider Provider
Reprovider Reprovider
Expand Down
15 changes: 15 additions & 0 deletions config/dns.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package config

// DNS specifies DNS resolution rules using custom resolvers
type DNS struct {
// Resolvers is a map of FQDNs to URLs for custom DNS resolution.
// URLs starting with `https://` indicate DoH endpoints.
// Support for other resolver types can be added in the future.
// https://en.wikipedia.org/wiki/Fully_qualified_domain_name
// https://en.wikipedia.org/wiki/DNS_over_HTTPS
//
// Example:
// - Custom resolver for ENS: `eth.` → `https://eth.link/dns-query`
// - Override the default OS resolver: `.` → `https://doh.applied-privacy.net/query`
Resolvers map[string]string
}
3 changes: 3 additions & 0 deletions config/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ func InitWithIdentity(identity Identity) (*Config, error) {
Pinning: Pinning{
RemoteServices: map[string]RemotePinningService{},
},
DNS: DNS{
Resolvers: map[string]string{},
},
}

return conf, nil
Expand Down

0 comments on commit a7702d2

Please sign in to comment.