mirror of https://codeberg.org/pzp/pzp-hub.git
use net.listen() pubkey field
This commit is contained in:
parent
a63a54987d
commit
e3fe7e88e4
|
@ -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 = {
|
module.exports = {
|
||||||
name: 'hub',
|
name: 'hub',
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
|
@ -84,7 +69,7 @@ module.exports = {
|
||||||
pull.filter(
|
pull.filter(
|
||||||
({ type }) => type === 'connecting-failed' || type === 'disconnected'
|
({ type }) => type === 'connecting-failed' || type === 'disconnected'
|
||||||
),
|
),
|
||||||
pull.map(({ address }) => extractSHSEPubkey(address)),
|
pull.map(({ pubkey }) => pubkey),
|
||||||
pull.filter((pubkey) => !!pubkey && attendants.has(pubkey)),
|
pull.filter((pubkey) => !!pubkey && attendants.has(pubkey)),
|
||||||
pull.drain((pubkey) => {
|
pull.drain((pubkey) => {
|
||||||
debug('farewell %s', pubkey)
|
debug('farewell %s', pubkey)
|
||||||
|
|
Loading…
Reference in New Issue