Changed, should work now

This commit is contained in:
MarcUs7 2025-01-02 21:45:45 +01:00
parent 3b1542dd68
commit 09c1c6d6c7
2 changed files with 9 additions and 65 deletions

View file

@ -52,39 +52,11 @@ export default {
validStatus : [200], // optional, Which http status should be considered non errors [defaults to 200-299]
},
{
id : 'btcnd-onion', // optional
id : 'btcnd-onion-POWERFUL', // optional
name : 'Bitcoin Node (Onion)', // optional
link : false, // optional, for notifications and dashboard only, [defaults to endpoint.url], can be disabled by setting it to false
url : 'erkuzp5gzrcjqtrcuiku5whcjnioalwskgo3hjg5oq2mmailml7k7jad.onion:8333', // required
customCheck: async (content, response) => {
return true;
// Bitcoin protocol version check
try {
const net = require('net');
return new Promise((resolve) => {
const socket = new net.Socket();
socket.setTimeout(5000); // 5 second timeout
socket.on('connect', () => {
socket.destroy();
resolve(true);
});
socket.on('error', () => {
resolve(false);
});
socket.on('timeout', () => {
socket.destroy();
resolve(false);
});
socket.connect(8333, '127.0.0.1');
});
} catch (e) {
return false;
}
},
url : 'http://erkuzp5gzrcjqtrcuiku5whcjnioalwskgo3hjg5oq2mmailml7k7jad.onion:8333', // required
customCheck : async (content, response)=>{return true;},
validStatus : ['SOCKET'], // optional, Which http status should be considered non errors [defaults to 200-299]
},
{
@ -166,42 +138,13 @@ export default {
validStatus : [200], // optional, Which http status should be considered non errors [defaults to 200-299]
},
{
id : 'xmrnd-onion', // optional
id : 'xmrnd-onion-POWERFUL', // optional
name : 'Monero Node (Onion)', // optional
link : false, // optional, for notifications and dashboard only, [defaults to endpoint.url], can be disabled by setting it to false
url : 'https://xmrnd.marcus7i.net', // required
request : { // optional, fetch options
method: 'GET',
agent: new SocksProxyAgent('socks5h://127.0.0.1:9050')
},
customCheck: async (content, response) => {
try {
const net = require('net');
return new Promise((resolve) => {
const socket = new net.Socket();
socket.setTimeout(5000);
socket.on('connect', () => {
socket.destroy();
resolve(true);
});
socket.on('error', () => {
resolve(false);
});
socket.on('timeout', () => {
socket.destroy();
resolve(false);
});
socket.connect(18081, '127.0.0.1');
});
} catch (e) {
return false;
}
},
validStatus : [200, 'SOCKET'], // optional, Which http status should be considered non errors [defaults to 200-299]
request : null,
customCheck : async (content, response)=>{return true;},
validStatus : ['SOCKET'], // optional, Which http status should be considered non errors [defaults to 200-299]
}
]
}

View file

@ -217,7 +217,8 @@ while(true) {
try {
if (endpoint.url.includes('.onion')) {
const [host, port] = endpoint.url.split(':');
const result = await checkOnionService('127.0.0.1', port || 8333);
host = endpoint.id.includes('-POWERFUL') ? '192.168.0.106' : '127.0.0.1';
const result = await checkOnionService(host, port || 8333);
endpointStatus.t = Date.now();
endpointStatus.dur = 0;