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

feat: add auto-tls support #716

Merged
merged 2 commits into from
Jan 13, 2025
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
1 change: 1 addition & 0 deletions packages/helia/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"@helia/interface": "^5.1.0",
"@helia/routers": "^2.2.0",
"@helia/utils": "^1.1.0",
"@libp2p/auto-tls": "^1.0.4",
"@libp2p/autonat": "^2.0.12",
"@libp2p/bootstrap": "^11.0.13",
"@libp2p/circuit-relay-v2": "^3.1.3",
Expand Down
6 changes: 6 additions & 0 deletions packages/helia/src/utils/libp2p-defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,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 { autoTLS } from '@libp2p/auto-tls'
import { autoNAT } from '@libp2p/autonat'
import { bootstrap } from '@libp2p/bootstrap'
import { circuitRelayTransport, circuitRelayServer, type CircuitRelayService } from '@libp2p/circuit-relay-v2'
Expand All @@ -23,10 +24,12 @@ import * as libp2pInfo from 'libp2p/version'
import { name, version } from '../version.js'
import { bootstrapConfig } from './bootstrappers.js'
import type { Libp2pDefaultsOptions } from './libp2p.js'
import type { AutoTLS } from '@libp2p/auto-tls'
import type { Libp2pOptions } from 'libp2p'

export interface DefaultLibp2pServices extends Record<string, unknown> {
autoNAT: unknown
autoTLS: AutoTLS
dcutr: unknown
delegatedRouting: unknown
dht: KadDHT
Expand All @@ -46,7 +49,9 @@ export function libp2pDefaults (options: Libp2pDefaultsOptions = {}): Libp2pOpti
addresses: {
listen: [
'/ip4/0.0.0.0/tcp/0',
'/ip4/0.0.0.0/tcp/0/ws',
'/ip6/::/tcp/0',
'/ip6/::/tcp/0/ws',
'/p2p-circuit',
'/webrtc'
]
Expand All @@ -72,6 +77,7 @@ export function libp2pDefaults (options: Libp2pDefaultsOptions = {}): Libp2pOpti
],
services: {
autoNAT: autoNAT(),
autoTLS: autoTLS(),
dcutr: dcutr(),
delegatedRouting: () => createDelegatedRoutingV1HttpApiClient('https://delegated-ipfs.dev', delegatedHTTPRoutingDefaults()),
dht: kadDHT({
Expand Down
2 changes: 2 additions & 0 deletions packages/interop/src/fixtures/create-helia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export async function createHeliaNode (libp2pOptions?: Libp2pOptions): Promise<H
delete defaults.services.dcutr
// @ts-expect-error services.delegatedRouting is not optional
delete defaults.services.delegatedRouting
// @ts-expect-error services.autoTLS is not optional
delete defaults.services.autoTLS

return createHelia<Libp2p<DefaultLibp2pServices>>({
blockBrokers: [
Expand Down
Loading