76 lines
2.0 KiB
JavaScript
76 lines
2.0 KiB
JavaScript
import { Client } from 'ssh2';
|
|
|
|
const conn = new Client();
|
|
|
|
conn.on('ready', () => {
|
|
console.log('=== 检查域名解析 ===\n');
|
|
|
|
conn.exec('nslookup hs.yifenbao.cn', (err, stream) => {
|
|
if (err) {
|
|
console.log('DNS检查失败:', err.message);
|
|
conn.end();
|
|
return;
|
|
}
|
|
|
|
stream.on('data', (data) => {
|
|
console.log('DNS解析:', data.toString());
|
|
});
|
|
|
|
stream.on('close', () => {
|
|
conn.exec('dig hs.yifenbao.cn +short', (err, stream2) => {
|
|
if (err) {
|
|
console.log('Dig检查失败:', err.message);
|
|
conn.end();
|
|
return;
|
|
}
|
|
|
|
stream2.on('data', (data) => {
|
|
console.log('\nDig结果:', data.toString());
|
|
});
|
|
|
|
stream2.on('close', () => {
|
|
conn.exec('curl -s -k -A "Mozilla/5.0 (Linux; Android 10) AppleWebKit/537.36" https://hs.yifenbao.cn/ 2>&1', (err, stream3) => {
|
|
if (err) {
|
|
console.log('手机端测试失败:', err.message);
|
|
conn.end();
|
|
return;
|
|
}
|
|
|
|
stream3.on('data', (data) => {
|
|
console.log('\n手机端测试:', data.toString().substring(0, 500));
|
|
});
|
|
|
|
stream3.on('close', () => {
|
|
conn.exec('docker logs huishou-backend --tail 5', (err, stream4) => {
|
|
if (err) {
|
|
console.log('容器日志失败:', err.message);
|
|
conn.end();
|
|
return;
|
|
}
|
|
|
|
stream4.on('data', (data) => {
|
|
console.log('\n容器日志:', data.toString());
|
|
});
|
|
|
|
stream4.on('close', () => {
|
|
conn.end();
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
conn.on('error', (err) => {
|
|
console.log('连接错误:', err.message);
|
|
});
|
|
|
|
conn.connect({
|
|
host: 'hs.yifenbao.cn',
|
|
port: 22,
|
|
username: 'root',
|
|
password: 'Torch1112'
|
|
}); |