Skip to content

Commit

Permalink
Merge branch 'main' into chore/update-interop
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain authored Jun 6, 2024
2 parents c1795df + 6011d36 commit b9f9536
Show file tree
Hide file tree
Showing 86 changed files with 1,698 additions and 647 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ jobs:
id-token: write
pull-requests: write
steps:
- uses: google-github-actions/release-please-action@v4
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ secrets.UCI_GITHUB_TOKEN || github.token }}
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"interop":"2.0.33","packages/connection-encrypter-plaintext":"1.0.24","packages/connection-encrypter-tls":"1.0.11","packages/crypto":"4.1.2","packages/interface":"1.4.0","packages/interface-compliance-tests":"5.4.5","packages/interface-internal":"1.2.2","packages/kad-dht":"12.0.17","packages/keychain":"4.0.15","packages/libp2p":"1.6.0","packages/logger":"4.0.13","packages/metrics-prometheus":"3.0.24","packages/metrics-simple":"1.0.2","packages/multistream-select":"5.1.10","packages/peer-collections":"5.2.2","packages/peer-discovery-bootstrap":"10.0.24","packages/peer-discovery-mdns":"10.0.24","packages/peer-id":"4.1.2","packages/peer-id-factory":"4.1.2","packages/peer-record":"7.0.18","packages/peer-store":"10.0.19","packages/protocol-autonat":"1.0.21","packages/protocol-dcutr":"1.0.21","packages/protocol-echo":"1.0.7","packages/protocol-fetch":"1.0.18","packages/protocol-identify":"2.0.2","packages/protocol-perf":"3.0.24","packages/protocol-ping":"1.0.19","packages/pubsub":"9.0.19","packages/pubsub-floodsub":"9.0.20","packages/record":"4.0.2","packages/stream-multiplexer-mplex":"10.0.24","packages/transport-circuit-relay-v2":"1.0.24","packages/transport-tcp":"9.0.26","packages/transport-webrtc":"4.0.33","packages/transport-websockets":"8.0.24","packages/transport-webtransport":"4.0.32","packages/upnp-nat":"1.0.22","packages/utils":"5.4.2"}
{"packages/connection-encrypter-plaintext":"1.0.24","packages/connection-encrypter-tls":"1.0.12","packages/crypto":"4.1.2","packages/interface":"1.4.0","packages/interface-compliance-tests":"5.4.5","packages/interface-internal":"1.2.2","packages/kad-dht":"12.0.17","packages/keychain":"4.0.15","packages/libp2p":"1.6.0","packages/logger":"4.0.13","packages/metrics-devtools":"0.1.0","packages/metrics-prometheus":"3.0.24","packages/metrics-simple":"1.0.2","packages/multistream-select":"5.1.10","packages/peer-collections":"5.2.2","packages/peer-discovery-bootstrap":"10.0.24","packages/peer-discovery-mdns":"10.0.24","packages/peer-id":"4.1.2","packages/peer-id-factory":"4.1.2","packages/peer-record":"7.0.18","packages/peer-store":"10.0.19","packages/protocol-autonat":"1.0.21","packages/protocol-dcutr":"1.0.21","packages/protocol-echo":"1.0.7","packages/protocol-fetch":"1.0.18","packages/protocol-identify":"2.0.2","packages/protocol-perf":"3.0.24","packages/protocol-ping":"1.0.19","packages/pubsub":"9.0.19","packages/pubsub-floodsub":"9.0.20","packages/record":"4.0.2","packages/stream-multiplexer-mplex":"10.0.24","packages/transport-circuit-relay-v2":"1.0.24","packages/transport-tcp":"9.0.26","packages/transport-webrtc":"4.0.33","packages/transport-websockets":"8.0.24","packages/transport-webtransport":"4.0.32","packages/upnp-nat":"1.0.22","packages/utils":"5.4.2"}
2 changes: 1 addition & 1 deletion .release-please.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
{ "type": "refactor", "section": "Refactors", "hidden": false }
],
"packages": {
"interop": {},
"packages/connection-encrypter-plaintext": {},
"packages/connection-encrypter-tls": {},
"packages/crypto": {},
Expand All @@ -20,6 +19,7 @@
"packages/keychain": {},
"packages/libp2p": {},
"packages/logger": {},
"packages/metrics-devtools": {},
"packages/metrics-prometheus": {},
"packages/metrics-simple": {},
"packages/multistream-select": {},
Expand Down
2 changes: 1 addition & 1 deletion doc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"doc-check": "aegir doc-check"
},
"devDependencies": {
"aegir": "^42.2.11"
"aegir": "^43.0.1"
},
"private": true
}
2 changes: 1 addition & 1 deletion interop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@libp2p/websockets": "^8.0.24",
"@libp2p/webtransport": "^4.0.32",
"@multiformats/multiaddr": "^12.2.3",
"aegir": "^42.2.11",
"aegir": "^43.0.1",
"libp2p": "^1.6.0",
"p-event": "^6.0.1",
"redis": "^4.6.14"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"docs:no-publish": "aegir docs --publish false -- --exclude interop --exclude doc"
},
"devDependencies": {
"aegir": "^42.0.0",
"aegir": "^43.0.1",
"npm-run-all": "^4.1.5"
},
"eslintConfig": {
Expand Down
2 changes: 1 addition & 1 deletion packages/connection-encrypter-plaintext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@libp2p/logger": "^4.0.13",
"@libp2p/peer-id-factory": "^4.1.2",
"@multiformats/multiaddr": "^12.2.3",
"aegir": "^42.2.11",
"aegir": "^43.0.1",
"protons": "^7.5.0",
"sinon": "^18.0.0"
},
Expand Down
7 changes: 7 additions & 0 deletions packages/connection-encrypter-tls/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
* devDependencies
* @libp2p/interface-compliance-tests bumped from ^5.3.0 to ^5.3.1

## [1.0.12](https://github.com/libp2p/js-libp2p/compare/tls-v1.0.11...tls-v1.0.12) (2024-05-28)


### Bug Fixes

* export tls key as pkcs8 ([#2562](https://github.com/libp2p/js-libp2p/issues/2562)) ([167bf2b](https://github.com/libp2p/js-libp2p/commit/167bf2b3cf0aa741c8118e241c3668e8ef91c549))

## [1.0.11](https://github.com/libp2p/js-libp2p/compare/tls-v1.0.10...tls-v1.0.11) (2024-05-17)


Expand Down
4 changes: 2 additions & 2 deletions packages/connection-encrypter-tls/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@libp2p/tls",
"version": "1.0.11",
"version": "1.0.12",
"description": "A connection encrypter that uses TLS 1.3",
"license": "Apache-2.0 OR MIT",
"homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/connection-encrypter-tls#readme",
Expand Down Expand Up @@ -67,7 +67,7 @@
"@libp2p/logger": "^4.0.13",
"@libp2p/peer-id-factory": "^4.1.2",
"@multiformats/multiaddr": "^12.2.3",
"aegir": "^42.2.11",
"aegir": "^43.0.1",
"protons": "^7.5.0",
"sinon": "^18.0.0"
},
Expand Down
6 changes: 3 additions & 3 deletions packages/connection-encrypter-tls/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ export async function generateCertificate (peerId: PeerId): Promise<{ cert: stri
]
})

const certPrivateKeySpki = await crypto.subtle.exportKey('spki', keys.privateKey)
const certPrivateKeyPkcs8 = await crypto.subtle.exportKey('pkcs8', keys.privateKey)

return {
cert: selfCert.toString(),
key: spkiToPEM(certPrivateKeySpki)
key: pkcs8ToPEM(certPrivateKeyPkcs8)
}
}

Expand Down Expand Up @@ -213,7 +213,7 @@ export function encodeSignatureData (certPublicKey: ArrayBuffer): Uint8Array {
])
}

function spkiToPEM (keydata: ArrayBuffer): string {
function pkcs8ToPEM (keydata: ArrayBuffer): string {
return formatAsPem(uint8ArrayToString(new Uint8Array(keydata), 'base64'))
}

Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
},
"devDependencies": {
"@types/mocha": "^10.0.6",
"aegir": "^42.2.11",
"aegir": "^43.0.1",
"benchmark": "^2.1.4",
"protons": "^7.5.0"
},
Expand Down
67 changes: 59 additions & 8 deletions packages/integration-tests/.aegir.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { pipe } from 'it-pipe'
import { execa } from 'execa'
import pDefer from 'p-defer'

/** @type {import('aegir').PartialOptions} */
export default {
Expand All @@ -18,6 +19,7 @@ export default {
const { plaintext } = await import('@libp2p/plaintext')
const { circuitRelayServer, circuitRelayTransport } = await import('@libp2p/circuit-relay-v2')
const { identify } = await import('@libp2p/identify')
const { echo } = await import('@libp2p/echo')

const peerId = await createEd25519PeerId()
const libp2p = await createLibp2p({
Expand Down Expand Up @@ -49,24 +51,73 @@ export default {
reservations: {
maxReservations: Infinity
}
})
}),
echo: echo()
}
})
// Add the echo protocol
await libp2p.handle('/echo/1.0.0', ({ stream }) => {
pipe(stream, stream)
.catch() // sometimes connections are closed before multistream-select finishes which causes an error
})

const goLibp2pRelay = await createGoLibp2pRelay()

return {
libp2p,
goLibp2pRelay,
env: {
RELAY_MULTIADDR: libp2p.getMultiaddrs().filter(ma => WebSockets.matches(ma)).pop()
RELAY_MULTIADDR: libp2p.getMultiaddrs().filter(ma => WebSockets.matches(ma)).pop(),
GO_RELAY_PEER: goLibp2pRelay.peerId,
GO_RELAY_MULTIADDRS: goLibp2pRelay.multiaddrs,
GO_RELAY_APIADDR: goLibp2pRelay.apiAddr
}
}
},
after: async (_, before) => {
await before.libp2p.stop()
await before.goLibp2pRelay.proc.kill()
}
}
}

async function createGoLibp2pRelay () {
const { multiaddr } = await import('@multiformats/multiaddr')
const { path: p2pd } = await import('go-libp2p')
const { createClient } = await import('@libp2p/daemon-client')

const controlPort = Math.floor(Math.random() * (50000 - 10000 + 1)) + 10000
const apiAddr = multiaddr(`/ip4/127.0.0.1/tcp/${controlPort}`)
const deferred = pDefer()
const proc = execa(p2pd(), [
`-listen=${apiAddr.toString()}`,
// listen on TCP, WebSockets and WebTransport
'-hostAddrs=/ip4/127.0.0.1/tcp/0,/ip4/127.0.0.1/tcp/0/ws,/ip4/127.0.0.1/udp/0/quic-v1/webtransport',
'-noise=true',
'-dhtServer',
'-relay',
'-muxer=mplex'
], {
env: {
GOLOG_LOG_LEVEL: 'debug'
}
})
proc.catch(() => {
// go-libp2p daemon throws when killed
})

proc.stdout?.on('data', (buf) => {
const str = buf.toString()

// daemon has started
if (str.includes('Control socket:')) {
deferred.resolve()
}
})
await deferred.promise

const daemonClient = createClient(apiAddr)
const id = await daemonClient.identify()

return {
apiAddr,
peerId: id.peerId.toString(),
multiaddrs: id.addrs.map(ma => ma.toString()).join(','),
proc
}
}
6 changes: 5 additions & 1 deletion packages/integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"@libp2p/daemon-client": "^8.0.5",
"@libp2p/daemon-server": "^7.0.5",
"@libp2p/dcutr": "^1.0.20",
"@libp2p/echo": "^1.0.7",
"@libp2p/fetch": "^1.0.17",
"@libp2p/floodsub": "^9.0.19",
"@libp2p/identify": "^2.0.1",
Expand All @@ -61,10 +62,13 @@
"@libp2p/tls": "^1.0.10",
"@libp2p/webrtc": "^4.0.32",
"@libp2p/websockets": "^8.0.23",
"@libp2p/webtransport": "^4.0.32",
"@multiformats/mafmt": "^12.1.6",
"@multiformats/multiaddr": "^12.2.3",
"aegir": "^42.2.11",
"@multiformats/multiaddr-matcher": "^1.2.1",
"aegir": "^43.0.1",
"delay": "^6.0.0",
"detect-browser": "^5.3.0",
"execa": "^9.1.0",
"go-libp2p": "^1.2.0",
"it-all": "^3.0.6",
Expand Down
Loading

0 comments on commit b9f9536

Please sign in to comment.