@helia/verified-fetch 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +24 -1
- package/dist/index.min.js +8 -19
- package/dist/src/index.d.ts +29 -4
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +41 -5
- package/dist/src/index.js.map +1 -1
- package/dist/src/utils/parse-resource.d.ts +2 -2
- package/dist/src/utils/parse-url-string.d.ts +2 -2
- package/dist/src/utils/parse-url-string.d.ts.map +1 -1
- package/dist/src/utils/parse-url-string.js +1 -1
- package/dist/src/utils/parse-url-string.js.map +1 -1
- package/dist/src/verified-fetch.d.ts +2 -1
- package/dist/src/verified-fetch.d.ts.map +1 -1
- package/dist/src/verified-fetch.js +1 -7
- package/dist/src/verified-fetch.js.map +1 -1
- package/package.json +4 -3
- package/src/index.ts +49 -8
- package/src/utils/parse-resource.ts +2 -2
- package/src/utils/parse-url-string.ts +3 -3
- package/src/verified-fetch.ts +3 -8
package/README.md
CHANGED
|
@@ -177,7 +177,7 @@ Note that you do not need to provide both a DNS-over-HTTPS and a DNS-over-JSON r
|
|
|
177
177
|
|
|
178
178
|
```typescript
|
|
179
179
|
import { createVerifiedFetch } from '@helia/verified-fetch'
|
|
180
|
-
import { dnsJsonOverHttps, dnsOverHttps } from '@
|
|
180
|
+
import { dnsJsonOverHttps, dnsOverHttps } from '@multiformats/dns/resolvers'
|
|
181
181
|
|
|
182
182
|
const fetch = await createVerifiedFetch({
|
|
183
183
|
gateways: ['https://trustless-gateway.link'],
|
|
@@ -189,6 +189,29 @@ const fetch = await createVerifiedFetch({
|
|
|
189
189
|
})
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
+
## Example - Customizing DNS per-TLD resolvers
|
|
193
|
+
|
|
194
|
+
DNS resolvers can be configured to only service DNS queries for specific
|
|
195
|
+
TLDs:
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
import { createVerifiedFetch } from '@helia/verified-fetch'
|
|
199
|
+
import { dnsJsonOverHttps, dnsOverHttps } from '@multiformats/dns/resolvers'
|
|
200
|
+
|
|
201
|
+
const fetch = await createVerifiedFetch({
|
|
202
|
+
gateways: ['https://trustless-gateway.link'],
|
|
203
|
+
routers: ['http://delegated-ipfs.dev'],
|
|
204
|
+
dnsResolvers: {
|
|
205
|
+
// this resolver will only be used for `.com` domains (note - this could
|
|
206
|
+
// also be an array of resolvers)
|
|
207
|
+
'com.': dnsJsonOverHttps('https://my-dns-resolver.example.com/dns-json'),
|
|
208
|
+
// this resolver will be used for everything else (note - this could
|
|
209
|
+
// also be an array of resolvers)
|
|
210
|
+
'.': dnsOverHttps('https://my-dns-resolver.example.com/dns-query')
|
|
211
|
+
}
|
|
212
|
+
})
|
|
213
|
+
```
|
|
214
|
+
|
|
192
215
|
### IPLD codec handling
|
|
193
216
|
|
|
194
217
|
IPFS supports several data formats (typically referred to as codecs) which are included in the CID. `@helia/verified-fetch` attempts to abstract away some of the details for easier consumption.
|