use net.listen() pubkey field

This commit is contained in:
Andre Staltz 2024-01-16 11:03:37 +02:00
parent a63a54987d
commit e3fe7e88e4
No known key found for this signature in database
GPG Key ID: 9EDE23EA7E8A4890
1 changed files with 1 additions and 16 deletions

View File

@ -17,21 +17,6 @@ function ErrorDuplex(message) {
}
}
/**
* @param {string} addresses
* @returns {string | undefined}
*/
function extractSHSEPubkey(addresses) {
for (const address of addresses.split(';')) {
for (const [transport, transform] of address.split('~')) {
const [name, pubkey, extra] = transform.split(':')
if (name === 'shse') {
return pubkey
}
}
}
}
module.exports = {
name: 'hub',
version: '1.0.0',
@ -84,7 +69,7 @@ module.exports = {
pull.filter(
({ type }) => type === 'connecting-failed' || type === 'disconnected'
),
pull.map(({ address }) => extractSHSEPubkey(address)),
pull.map(({ pubkey }) => pubkey),
pull.filter((pubkey) => !!pubkey && attendants.has(pubkey)),
pull.drain((pubkey) => {
debug('farewell %s', pubkey)