Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add tls to default delegated routing filters #670

Merged
merged 5 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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']
}
}
Loading