You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
557 B
JavaScript
33 lines
557 B
JavaScript
// const fetch = require('node-fetch');
|
|
|
|
class LokiP2pAPI {
|
|
constructor() {
|
|
this.contactP2pDetails = {};
|
|
}
|
|
|
|
addContactP2pDetails(pubKey, address, port) {
|
|
this.contactP2pDetails[pubKey] = {
|
|
address,
|
|
port,
|
|
};
|
|
}
|
|
|
|
getContactP2pDetails(pubKey) {
|
|
if (this.contactP2pDetails[pubKey]) {
|
|
return this.contactP2pDetails[pubKey];
|
|
}
|
|
return null;
|
|
}
|
|
|
|
removeContactP2pDetails(pubKey, address, port) {
|
|
this.contactP2pDetails[pubKey] = {
|
|
address,
|
|
port,
|
|
};
|
|
}
|
|
}
|
|
|
|
module.exports = {
|
|
LokiP2pAPI,
|
|
};
|