Skip to content

Commit

Permalink
fix: add tls to default delegated routing filters (#670)
Browse files Browse the repository at this point in the history
* fix: add tls to all default filters

* chore: avoid duplication of filters

* fix: use normal imports with .js

* chore: export delegated routing defaults

* fix: import

---------

Co-authored-by: Daniel N <2color@users.noreply.github.com>
  • Loading branch information
2color and 2color authored Nov 4, 2024
1 parent e58e49c commit aecac3d
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
6 changes: 2 additions & 4 deletions packages/helia/src/utils/libp2p-defaults.browser.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { noise } from '@chainsafe/libp2p-noise'
import { yamux } from '@chainsafe/libp2p-yamux'
import { createDelegatedRoutingV1HttpApiClient } from '@helia/delegated-routing-v1-http-api-client'
import { delegatedHTTPRoutingDefaults } from '@helia/routers'
import { autoNAT } from '@libp2p/autonat'
import { bootstrap } from '@libp2p/bootstrap'
import { circuitRelayTransport } from '@libp2p/circuit-relay-v2'
Expand Down Expand Up @@ -63,10 +64,7 @@ export function libp2pDefaults (options: Libp2pDefaultsOptions = {}): Libp2pOpti
services: {
autoNAT: autoNAT(),
dcutr: dcutr(),
delegatedRouting: () => createDelegatedRoutingV1HttpApiClient('https://delegated-ipfs.dev', {
filterProtocols: ['unknown', 'transport-bitswap', 'transport-ipfs-gateway-http'],
filterAddrs: ['https', 'webtransport', 'webrtc', 'webrtc-direct', 'wss']
}),
delegatedRouting: () => createDelegatedRoutingV1HttpApiClient('https://delegated-ipfs.dev', delegatedHTTPRoutingDefaults()),
dht: kadDHT({
clientMode: true,
validators: {
Expand Down
6 changes: 2 additions & 4 deletions packages/helia/src/utils/libp2p-defaults.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { noise } from '@chainsafe/libp2p-noise'
import { yamux } from '@chainsafe/libp2p-yamux'
import { createDelegatedRoutingV1HttpApiClient } from '@helia/delegated-routing-v1-http-api-client'
import { delegatedHTTPRoutingDefaults } from '@helia/routers'
import { autoNAT } from '@libp2p/autonat'
import { bootstrap } from '@libp2p/bootstrap'
import { circuitRelayTransport, circuitRelayServer, type CircuitRelayService } from '@libp2p/circuit-relay-v2'
Expand Down Expand Up @@ -72,10 +73,7 @@ export function libp2pDefaults (options: Libp2pDefaultsOptions = {}): Libp2pOpti
services: {
autoNAT: autoNAT(),
dcutr: dcutr(),
delegatedRouting: () => createDelegatedRoutingV1HttpApiClient('https://delegated-ipfs.dev', {
filterProtocols: ['unknown', 'transport-bitswap', 'transport-ipfs-gateway-http'],
filterAddrs: ['https', 'tcp', 'webrtc', 'webrtc-direct', 'wss']
}),
delegatedRouting: () => createDelegatedRoutingV1HttpApiClient('https://delegated-ipfs.dev', delegatedHTTPRoutingDefaults()),
dht: kadDHT({
validators: {
ipns: ipnsValidator
Expand Down
1 change: 1 addition & 0 deletions packages/routers/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Abstraction layer over different content and peer routing mechanisms.
*/
export { delegatedHTTPRouting } from './delegated-http-routing.js'
export { delegatedHTTPRoutingDefaults } from './utils/delegated-http-routing-defaults.js'
export { httpGatewayRouting } from './http-gateway-routing.js'
export type { HTTPGatwayRouterInit } from './http-gateway-routing.js'
export { libp2pRouting } from './libp2p-routing.js'
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import type { DelegatedRoutingV1HttpApiClientInit } from '@helia/delegated-routi
export function delegatedHTTPRoutingDefaults (): DelegatedRoutingV1HttpApiClientInit {
return {
filterProtocols: ['unknown', 'transport-bitswap', 'transport-ipfs-gateway-http'],
filterAddrs: ['https', 'webtransport', 'webrtc', 'webrtc-direct', 'wss']
filterAddrs: ['https', 'webtransport', 'webrtc', 'webrtc-direct', 'wss', 'tls']
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import type { DelegatedRoutingV1HttpApiClientInit } from '@helia/delegated-routi
export function delegatedHTTPRoutingDefaults (): DelegatedRoutingV1HttpApiClientInit {
return {
filterProtocols: ['unknown', 'transport-bitswap', 'transport-ipfs-gateway-http'],
filterAddrs: ['https', 'tcp', 'webrtc', 'webrtc-direct', 'wss']
filterAddrs: ['https', 'tcp', 'webrtc', 'webrtc-direct', 'wss', 'tls']
}
}

0 comments on commit aecac3d

Please sign in to comment.