-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds tests for tls encryption but as a major to control when it is pulled in to the js-libp2p monorepo. BREAKING CHANGE: tls support is required
- Loading branch information
1 parent
ba8a627
commit a19a735
Showing
6 changed files
with
45 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { runTests } from '../utils/test-matrix.js' | ||
import { echoStreamTests } from './echo.js' | ||
import type { DaemonFactory } from '../index.js' | ||
|
||
export async function streamTests (factory: DaemonFactory): Promise<void> { | ||
echoStreamTests(factory, 'mplex') | ||
echoStreamTests(factory, 'yamux') | ||
runTests('echo', echoStreamTests, factory) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { keys } from '../resources/keys/index.js' | ||
import type { DaemonFactory, Encryption, Muxer, NodeType, PeerIdType, SpawnOptions } from '../index.js' | ||
|
||
export interface TestFunction { | ||
(name: string, factory: DaemonFactory, optionsA: SpawnOptions, optionsB: SpawnOptions): void | ||
} | ||
|
||
export function runTests (name: string, fn: TestFunction, factory: DaemonFactory): void { | ||
const keyTypes: PeerIdType[] = ['ed25519', 'rsa', 'secp256k1'] | ||
const impls: NodeType[] = ['js', 'go'] | ||
const encrypters: Encryption[] = ['noise', 'tls'] | ||
const muxers: Muxer[] = ['mplex', 'yamux'] | ||
|
||
for (const keyType of keyTypes) { | ||
for (const implA of impls) { | ||
for (const implB of impls) { | ||
for (const encrypter of encrypters) { | ||
// eslint-disable-next-line max-depth | ||
for (const muxer of muxers) { | ||
fn( | ||
`${keyType}/${encrypter}/${muxer} ${name}`, | ||
factory, | ||
{ type: implA, encryption: encrypter, key: keys.go[keyType] }, | ||
{ type: implB, encryption: encrypter, key: keys.js[keyType] } | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |