소스 검색

移除测试文件

Taio_O 2 주 전
부모
커밋
8cd189206e
10개의 변경된 파일0개의 추가작업 그리고 1093개의 파일을 삭제
  1. 0 90
      get-chat-id.js
  2. 0 166
      go-analysis.md
  3. 0 157
      test-advanced-proxy.js
  4. 0 182
      test-connectivity.js
  5. 0 23
      test-direct-connection.js
  6. 0 79
      test-simple-proxy.js
  7. 0 148
      test-simple.js
  8. 0 77
      test-subscription-content.js
  9. 0 61
      test-subscription.js
  10. 0 110
      test-telegram.js

+ 0 - 90
get-chat-id.js

@@ -1,90 +0,0 @@
-#!/usr/bin/env node
-
-require('dotenv').config();
-const TelegramBot = require('node-telegram-bot-api');
-
-async function getChatId() {
-  console.log('🔍 获取Telegram Chat ID...\n');
-
-  const botToken = process.env.TELEGRAM_BOT_TOKEN;
-
-  if (!botToken) {
-    console.error('❌ 未配置TELEGRAM_BOT_TOKEN');
-    process.exit(1);
-  }
-
-  try {
-    console.log('📋 机器人配置信息:');
-    console.log(`   Bot Token: ${botToken.substring(0, 10)}...${botToken.substring(botToken.length - 10)}\n`);
-
-    // 创建机器人实例
-    const bot = new TelegramBot(botToken, { polling: false });
-
-    console.log('🔄 测试机器人连接...');
-    const me = await bot.getMe();
-    console.log('✅ 机器人连接成功!');
-    console.log(`   机器人名称: ${me.first_name}`);
-    console.log(`   机器人用户名: @${me.username}\n`);
-
-    console.log('📋 获取最近的更新...');
-    const updates = await bot.getUpdates();
-    
-    if (updates.length === 0) {
-      console.log('⚠️  没有找到任何更新记录');
-      console.log('\n📝 请按以下步骤操作:');
-      console.log('   1. 将机器人添加到群组或频道');
-      console.log('   2. 在群组中发送 /start 或任何消息');
-      console.log('   3. 再次运行此脚本');
-      return;
-    }
-
-    console.log(`✅ 找到 ${updates.length} 条更新记录\n`);
-
-    console.log('📊 Chat ID 列表:');
-    const chatIds = new Set();
-    
-    updates.forEach((update, index) => {
-      if (update.message) {
-        const chat = update.message.chat;
-        chatIds.add(chat.id);
-        console.log(`   ${index + 1}. Chat ID: ${chat.id}`);
-        console.log(`      类型: ${chat.type}`);
-        console.log(`      标题: ${chat.title || chat.first_name || '个人聊天'}`);
-        console.log(`      用户名: ${chat.username ? '@' + chat.username : '无'}`);
-        console.log('');
-      }
-    });
-
-    if (chatIds.size > 0) {
-      console.log('💡 建议使用的Chat ID:');
-      chatIds.forEach((chatId, index) => {
-        console.log(`   ${index + 1}. ${chatId}`);
-      });
-      
-      console.log('\n📝 配置方法:');
-      console.log('   在.env文件中设置:');
-      console.log(`   TELEGRAM_CHAT_ID=${Array.from(chatIds)[0]}`);
-    }
-
-  } catch (error) {
-    console.error('❌ 获取Chat ID失败:', error.message);
-    
-    if (error.response) {
-      console.error('   错误详情:', error.response.data);
-    }
-    
-    console.log('\n🔧 故障排除建议:');
-    console.log('   1. 检查Bot Token是否正确');
-    console.log('   2. 确保机器人已添加到群组/频道');
-    console.log('   3. 在群组中发送消息激活机器人');
-    
-    process.exit(1);
-  }
-}
-
-// 如果直接运行此文件
-if (require.main === module) {
-  getChatId();
-}
-
-module.exports = { getChatId }; 

+ 0 - 166
go-analysis.md

@@ -1,166 +0,0 @@
-# 为什么 Go 语言更适合 Clash 测速项目
-
-## 当前 Node.js 方案的问题
-
-### 1. 协议支持问题
-- **Shadowsocks**: Node.js 缺少成熟的 SS 客户端库
-- **VMess**: 需要实现复杂的 VMess 协议
-- **Trojan**: 需要 TLS 代理支持
-- **ShadowsocksR**: 协议更复杂,Node.js 支持更少
-
-### 2. 性能问题
-- **并发处理**: JavaScript 单线程模型,大量并发连接性能差
-- **内存使用**: Node.js 内存占用较高
-- **网络 I/O**: 异步处理不如 Go 的 goroutine 高效
-
-### 3. 生态系统问题
-- **代理库**: Node.js 生态中缺少完整的代理客户端库
-- **维护性**: 需要自己实现复杂的代理协议
-
-## Go 语言的优势
-
-### 1. 原生代理支持
-```go
-// Go 有成熟的代理库
-import (
-    "golang.org/x/net/proxy"
-    "github.com/Dreamacro/clash/adapter"
-    "github.com/Dreamacro/clash/transport/socks5"
-)
-```
-
-### 2. 高性能并发
-```go
-// 使用 goroutine 处理并发测速
-func testNodes(nodes []Node) {
-    semaphore := make(chan struct{}, 10) // 限制并发数
-    var wg sync.WaitGroup
-    
-    for _, node := range nodes {
-        wg.Add(1)
-        go func(n Node) {
-            defer wg.Done()
-            semaphore <- struct{}{}
-            defer func() { <-semaphore }()
-            
-            testNode(n)
-        }(node)
-    }
-    
-    wg.Wait()
-}
-```
-
-### 3. 更好的网络处理
-```go
-// Go 的网络库更底层,性能更好
-func testLatency(node Node) (int, error) {
-    start := time.Now()
-    
-    conn, err := net.DialTimeout("tcp", fmt.Sprintf("%s:%d", node.Server, node.Port), 10*time.Second)
-    if err != nil {
-        return 0, err
-    }
-    defer conn.Close()
-    
-    return int(time.Since(start).Milliseconds()), nil
-}
-```
-
-### 4. 丰富的代理库生态
-- **Clash**: 可以直接使用 Clash 的适配器
-- **Shadowsocks**: 有完整的 Go 实现
-- **VMess**: 有成熟的 VMess 客户端库
-- **Trojan**: 有专门的 Trojan 库
-
-## 推荐的 Go 架构
-
-### 1. 核心组件
-```go
-type SpeedTester struct {
-    nodes     []Node
-    results   chan TestResult
-    config    *Config
-}
-
-type Node struct {
-    Name     string
-    Type     string
-    Server   string
-    Port     int
-    Password string
-    // 其他配置...
-}
-```
-
-### 2. 代理适配器
-```go
-type ProxyAdapter interface {
-    TestLatency() (int, error)
-    TestSpeed() (float64, float64, error)
-    GetIP() (string, error)
-}
-
-// 为每种代理类型实现适配器
-type ShadowsocksAdapter struct {
-    node *Node
-}
-
-type VMessAdapter struct {
-    node *Node
-}
-```
-
-### 3. 并发测速
-```go
-func (st *SpeedTester) TestAll() []TestResult {
-    results := make([]TestResult, 0, len(st.nodes))
-    resultChan := make(chan TestResult, len(st.nodes))
-    
-    // 启动并发测速
-    for _, node := range st.nodes {
-        go func(n Node) {
-            result := st.testNode(n)
-            resultChan <- result
-        }(node)
-    }
-    
-    // 收集结果
-    for i := 0; i < len(st.nodes); i++ {
-        results = append(results, <-resultChan)
-    }
-    
-    return results
-}
-```
-
-## 迁移建议
-
-### 1. 保留现有功能
-- 数据库模型可以复用
-- API 接口保持兼容
-- 前端页面无需修改
-
-### 2. 逐步迁移
-1. 先实现核心测速功能
-2. 添加代理类型支持
-3. 集成数据库
-4. 添加 Web API
-5. 完善前端集成
-
-### 3. 技术栈选择
-- **Web 框架**: Gin 或 Echo
-- **数据库**: 继续使用 MySQL
-- **代理库**: Clash 适配器
-- **配置**: Viper
-- **日志**: Logrus
-
-## 结论
-
-Go 语言确实更适合这个项目,因为:
-1. **协议支持完整**: 有成熟的代理客户端库
-2. **性能更优**: 并发处理能力强
-3. **维护性好**: 代码结构清晰,易于扩展
-4. **生态丰富**: 代理相关库完善
-
-建议采用 Go 重写核心测速功能,保留现有的数据库和前端架构。 

+ 0 - 157
test-advanced-proxy.js

@@ -1,157 +0,0 @@
-const axios = require('axios');
-const { HttpsProxyAgent } = require('https-proxy-agent');
-const { SocksProxyAgent } = require('socks-proxy-agent');
-
-// 测试配置
-const testConfig = {
-  // 替换为你的实际代理配置
-  ss: {
-    name: 'SS-Node-1',
-    type: 'ss',
-    server: '1.2.3.4',
-    port: 8388,
-    password: 'your_password',
-    cipher: 'aes-256-gcm'
-  },
-  vmess: {
-    name: 'VMess-Node-1',
-    type: 'vmess',
-    server: '9.10.11.12',
-    port: 443,
-    uuid: 'your-uuid-here'
-  },
-  trojan: {
-    name: 'Trojan-Node-1',
-    type: 'trojan',
-    server: '17.18.19.20',
-    port: 443,
-    password: 'your_password'
-  }
-};
-
-/**
- * 创建代理Agent
- */
-function createProxyAgent(node) {
-  try {
-    console.log(`创建代理Agent: ${node.name} - ${node.type}`);
-    
-    switch (node.type) {
-      case 'ss':
-      case 'ssr':
-      case 'vmess':
-      case 'trojan':
-        // 尝试使用HTTP代理模式
-        console.log(`尝试HTTP代理模式: ${node.type} - ${node.name}`);
-        
-        // 构建代理URL
-        let proxyUrl = `http://${node.server}:${node.port}`;
-        
-        // 如果有认证信息,添加到URL中
-        if (node.username && node.password) {
-          proxyUrl = `http://${node.username}:${node.password}@${node.server}:${node.port}`;
-        }
-        
-        const agent = new HttpsProxyAgent(proxyUrl);
-        console.log(`高级代理创建成功: ${node.name} - ${proxyUrl}`);
-        return agent;
-        
-      default:
-        console.log(`不支持的代理类型: ${node.type} - ${node.name}`);
-        return null;
-    }
-    
-  } catch (error) {
-    console.error(`创建代理Agent失败: ${node.name}`, { error: error.message, type: node.type });
-    return null;
-  }
-}
-
-/**
- * 测试代理连接
- */
-async function testProxy(node) {
-  console.log(`\n=== 测试代理: ${node.name} ===`);
-  
-  try {
-    const agent = createProxyAgent(node);
-    
-    if (!agent) {
-      console.log(`❌ 无法创建代理Agent: ${node.name}`);
-      return false;
-    }
-    
-    console.log(`🔗 开始测试连接...`);
-    
-    const startTime = Date.now();
-    const response = await axios({
-      method: 'GET',
-      url: 'https://httpbin.org/ip',
-      httpsAgent: agent,
-      httpAgent: agent,
-      timeout: 10000,
-      headers: {
-        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
-      }
-    });
-    
-    const latency = Date.now() - startTime;
-    
-    console.log(`✅ 连接成功!`);
-    console.log(`📊 延迟: ${latency}ms`);
-    console.log(`🌐 IP地址: ${response.data.origin}`);
-    console.log(`📄 响应状态: ${response.status}`);
-    
-    return true;
-    
-  } catch (error) {
-    console.log(`❌ 连接失败: ${error.message}`);
-    
-    if (error.code === 'ECONNREFUSED') {
-      console.log(`💡 提示: 连接被拒绝,可能是代理服务器未运行或端口错误`);
-    } else if (error.code === 'ETIMEDOUT') {
-      console.log(`💡 提示: 连接超时,可能是网络问题或代理配置错误`);
-    } else if (error.code === 'ENOTFOUND') {
-      console.log(`💡 提示: 无法解析主机名,请检查服务器地址`);
-    }
-    
-    return false;
-  }
-}
-
-/**
- * 主测试函数
- */
-async function main() {
-  console.log('🚀 开始测试高级代理类型...\n');
-  
-  // 测试直接连接
-  console.log('=== 测试直接连接 ===');
-  try {
-    const directResponse = await axios.get('https://httpbin.org/ip', { timeout: 5000 });
-    console.log(`✅ 直接连接正常 - IP: ${directResponse.data.origin}`);
-  } catch (error) {
-    console.log(`❌ 直接连接失败: ${error.message}`);
-  }
-  
-  // 测试各种代理类型
-  const testNodes = [
-    testConfig.ss,
-    testConfig.vmess,
-    testConfig.trojan
-  ];
-  
-  for (const node of testNodes) {
-    await testProxy(node);
-  }
-  
-  console.log('\n🎯 测试完成!');
-  console.log('\n💡 提示:');
-  console.log('1. 如果所有代理都失败,请检查代理服务器是否正常运行');
-  console.log('2. 确保代理配置信息正确(服务器地址、端口、密码等)');
-  console.log('3. 某些代理类型可能需要特殊的客户端库支持');
-  console.log('4. 可以尝试使用Clash等代理客户端来验证代理是否可用');
-}
-
-// 运行测试
-main().catch(console.error); 

+ 0 - 182
test-connectivity.js

@@ -1,182 +0,0 @@
-const SpeedTester = require('./src/core/speedTester');
-const logger = require('./src/utils/logger');
-
-// 测试节点配置 - 使用Clash混合端口7897
-const testNodes = [
-  // 测试直连(不使用代理)
-  {
-    id: 1,
-    name: '直连测试',
-    type: 'direct',
-    server: '',
-    port: 0,
-    username: '',
-    password: ''
-  },
-  // Clash混合端口HTTP代理
-  {
-    id: 2,
-    name: '测试HTTP代理',
-    type: 'http',
-    server: '127.0.0.1',
-    port: 7897,
-    username: '',
-    password: ''
-  },
-  // Clash混合端口SOCKS5代理
-  {
-    id: 3,
-    name: '测试SOCKS5代理',
-    type: 'socks5',
-    server: '127.0.0.1',
-    port: 7897,
-    username: '',
-    password: ''
-  }
-];
-
-// 添加一个简单的直连测试函数
-async function testDirectConnection() {
-  console.log('🌐 测试直连连通性...');
-  
-  const axios = require('axios');
-  const testUrls = [
-    'https://www.google.com',
-    'https://httpbin.org/get',
-    'https://www.github.com'
-  ];
-  
-  for (const url of testUrls) {
-    try {
-      console.log(`尝试连接: ${url}`);
-      const startTime = Date.now();
-      const response = await axios.get(url, {
-        timeout: 10000,
-        headers: {
-          'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
-        }
-      });
-      const latency = Date.now() - startTime;
-      
-      console.log(`✅ 直连成功: ${url} (${latency}ms)`);
-      console.log(`状态码: ${response.status}`);
-      console.log(`IP: ${response.headers['x-forwarded-for'] || 'unknown'}`);
-      return true;
-    } catch (error) {
-      console.log(`❌ 直连失败: ${url} - ${error.message}`);
-    }
-  }
-  
-  console.log('❌ 所有直连测试都失败了,请检查网络连接');
-  return false;
-}
-
-async function testConnectivity() {
-  console.log('🚀 开始连通性测试...\n');
-  
-  // 首先测试直连
-  const directSuccess = await testDirectConnection();
-  console.log('');
-  
-  if (!directSuccess) {
-    console.log('⚠️  直连测试失败,代理测试可能也会失败');
-    console.log('请检查网络连接或防火墙设置\n');
-  }
-  
-  const speedTester = new SpeedTester();
-  
-  try {
-    // 测试单个节点
-    console.log('📡 测试代理节点...');
-    const singleResult = await speedTester.testNode(testNodes[1]); // 测试HTTP代理
-    console.log('单个节点测试结果:', JSON.stringify(singleResult, null, 2));
-    console.log('');
-    
-    // 批量测试节点
-    console.log('📡 批量测试节点...');
-    const batchResults = await speedTester.testNodes(testNodes.slice(1)); // 跳过直连测试
-    
-    console.log('\n📊 测试结果汇总:');
-    console.log('='.repeat(50));
-    
-    batchResults.forEach((result, index) => {
-      const node = testNodes[index + 1]; // +1 因为跳过了直连测试
-      const status = result.isSuccess ? '✅ 连通' : '❌ 不通';
-      const latency = result.latency ? `${result.latency}ms` : 'N/A';
-      const ip = result.ipAddress || 'N/A';
-      
-      console.log(`${status} ${node.name} (${node.type})`);
-      console.log(`   延迟: ${latency}`);
-      console.log(`   IP: ${ip}`);
-      console.log(`   测试URL: ${result.testUrl || 'N/A'}`);
-      if (result.errorMessage) {
-        console.log(`   错误: ${result.errorMessage}`);
-      }
-      console.log('');
-    });
-    
-    const successCount = batchResults.filter(r => r.isSuccess).length;
-    console.log(`总计: ${successCount}/${batchResults.length} 个节点连通`);
-    
-    // 提供故障排除建议
-    if (successCount === 0) {
-      console.log('\n🔧 故障排除建议:');
-      console.log('1. 检查代理服务是否正在运行');
-      console.log('2. 确认代理端口是否正确');
-      console.log('3. 检查防火墙设置');
-      console.log('4. 尝试使用其他代理服务器');
-      console.log('5. 检查代理配置是否正确');
-    }
-    
-  } catch (error) {
-    console.error('❌ 测试过程中发生错误:', error.message);
-  }
-}
-
-// 添加一个简单的代理检测函数
-async function detectLocalProxies() {
-  console.log('🔍 检测本地代理服务...');
-  
-  const net = require('net');
-  const commonPorts = [7897, 7891, 8118, 3128, 8388, 10808];
-  
-  for (const port of commonPorts) {
-    try {
-      const socket = new net.Socket();
-      const result = await new Promise((resolve) => {
-        socket.setTimeout(2000);
-        socket.on('connect', () => {
-          socket.destroy();
-          resolve(true);
-        });
-        socket.on('timeout', () => {
-          socket.destroy();
-          resolve(false);
-        });
-        socket.on('error', () => {
-          socket.destroy();
-          resolve(false);
-        });
-        socket.connect(port, '127.0.0.1');
-      });
-      
-      if (result) {
-        console.log(`✅ 发现本地代理服务: 127.0.0.1:${port}`);
-      }
-    } catch (error) {
-      // 忽略错误
-    }
-  }
-  
-  console.log('检测完成\n');
-}
-
-// 如果直接运行此脚本
-if (require.main === module) {
-  // 先检测本地代理
-  detectLocalProxies().then(() => {
-    return testConnectivity();
-  }).catch(console.error);
-}
-
-module.exports = { testConnectivity, testDirectConnection, detectLocalProxies }; 

+ 0 - 23
test-direct-connection.js

@@ -1,23 +0,0 @@
-const axios = require('axios');
-
-async function testDirectConnection() {
-  console.log('🔍 测试直接连接...');
-  
-  try {
-    const response = await axios.get('https://www.google.com', {
-      timeout: 10000,
-      headers: {
-        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
-      }
-    });
-    
-    console.log('✅ 直接连接成功');
-    console.log(`状态码: ${response.status}`);
-    console.log(`响应大小: ${response.data.length} 字符`);
-    
-  } catch (error) {
-    console.error('❌ 直接连接失败:', error.message);
-  }
-}
-
-testDirectConnection(); 

+ 0 - 79
test-simple-proxy.js

@@ -1,79 +0,0 @@
-const axios = require('axios');
-const { HttpsProxyAgent } = require('https-proxy-agent');
-const { SocksProxyAgent } = require('socks-proxy-agent');
-
-async function testDirectConnection() {
-  console.log('🔍 测试直接连接...');
-  try {
-    const response = await axios.get('https://httpbin.org/ip', {
-      timeout: 10000
-    });
-    console.log('✅ 直接连接成功:', response.data);
-    return true;
-  } catch (error) {
-    console.log('❌ 直接连接失败:', error.message);
-    return false;
-  }
-}
-
-async function testProxyConnection(proxyType, host, port, username = null, password = null) {
-  console.log(`🔍 测试${proxyType}代理: ${host}:${port}`);
-  
-  try {
-    let agent;
-    let proxyUrl;
-    
-    if (proxyType === 'http' || proxyType === 'https') {
-      proxyUrl = `${proxyType}://${host}:${port}`;
-      if (username && password) {
-        proxyUrl = `${proxyType}://${username}:${password}@${host}:${port}`;
-      }
-      agent = new HttpsProxyAgent(proxyUrl);
-    } else if (proxyType === 'socks5') {
-      proxyUrl = `socks5://${host}:${port}`;
-      if (username && password) {
-        proxyUrl = `socks5://${username}:${password}@${host}:${port}`;
-      }
-      agent = new SocksProxyAgent(proxyUrl);
-    } else {
-      console.log(`❌ 不支持的代理类型: ${proxyType}`);
-      return false;
-    }
-    
-    console.log(`使用代理URL: ${proxyUrl}`);
-    
-    const response = await axios.get('https://httpbin.org/ip', {
-      httpsAgent: agent,
-      httpAgent: agent,
-      timeout: 10000,
-      headers: {
-        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
-      }
-    });
-    
-    console.log('✅ 代理连接成功:', response.data);
-    return true;
-  } catch (error) {
-    console.log('❌ 代理连接失败:', error.message);
-    return false;
-  }
-}
-
-async function main() {
-  console.log('🚀 开始代理连接测试...\n');
-  
-  // 测试直接连接
-  await testDirectConnection();
-  console.log('');
-  
-  // 测试HTTP代理(如果有的话)
-  // 这里可以添加你的代理服务器信息
-  // await testProxyConnection('http', 'proxy.example.com', 8080);
-  
-  // 测试SOCKS5代理(如果有的话)
-  // await testProxyConnection('socks5', 'socks.example.com', 1080);
-  
-  console.log('✅ 测试完成');
-}
-
-main().catch(console.error); 

+ 0 - 148
test-simple.js

@@ -1,148 +0,0 @@
-const axios = require('axios');
-
-console.log('🔍 简单连通性测试\n');
-
-// 测试直连
-async function testDirect() {
-  console.log('1. 测试直连...');
-  
-  const urls = [
-    'https://httpbin.org/get',
-    'https://www.google.com',
-    'https://www.github.com'
-  ];
-  
-  for (const url of urls) {
-    try {
-      console.log(`   尝试: ${url}`);
-      const start = Date.now();
-      const response = await axios.get(url, {
-        timeout: 10000,
-        headers: {
-          'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
-        }
-      });
-      const latency = Date.now() - start;
-      
-      console.log(`   ✅ 成功: ${latency}ms (状态码: ${response.status})`);
-      return true;
-    } catch (error) {
-      console.log(`   ❌ 失败: ${error.message}`);
-    }
-  }
-  
-  console.log('   ❌ 所有直连测试都失败了');
-  return false;
-}
-
-// 测试本地代理端口
-async function testLocalProxy() {
-  console.log('\n2. 测试本地代理端口...');
-  
-  const net = require('net');
-  const ports = [8080, 1080, 7890, 7891, 8118, 3128];
-  
-  for (const port of ports) {
-    try {
-      const socket = new net.Socket();
-      const result = await new Promise((resolve) => {
-        socket.setTimeout(3000);
-        socket.on('connect', () => {
-          socket.destroy();
-          resolve(true);
-        });
-        socket.on('timeout', () => {
-          socket.destroy();
-          resolve(false);
-        });
-        socket.on('error', () => {
-          socket.destroy();
-          resolve(false);
-        });
-        socket.connect(port, '127.0.0.1');
-      });
-      
-      if (result) {
-        console.log(`   ✅ 端口 ${port} 可连接`);
-      } else {
-        console.log(`   ❌ 端口 ${port} 不可连接`);
-      }
-    } catch (error) {
-      console.log(`   ❌ 端口 ${port} 测试失败: ${error.message}`);
-    }
-  }
-}
-
-// 测试HTTP代理
-async function testHttpProxy() {
-  console.log('\n3. 测试HTTP代理...');
-  
-  try {
-    const { HttpsProxyAgent } = require('https-proxy-agent');
-    const proxyUrl = 'http://127.0.0.1:7897';
-    const agent = new HttpsProxyAgent(proxyUrl);
-    
-    const response = await axios.get('https://httpbin.org/get', {
-      httpsAgent: agent,
-      timeout: 10000,
-      headers: {
-        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
-      }
-    });
-    
-    console.log(`   ✅ HTTP代理测试成功: ${response.status}`);
-    console.log(`   IP: ${response.data.origin}`);
-  } catch (error) {
-    console.log(`   ❌ HTTP代理测试失败: ${error.message}`);
-  }
-}
-
-// 测试SOCKS5代理
-async function testSocks5Proxy() {
-  console.log('\n4. 测试SOCKS5代理...');
-  
-  try {
-    const { SocksProxyAgent } = require('socks-proxy-agent');
-    const proxyUrl = 'socks5://127.0.0.1:7897';
-    const agent = new SocksProxyAgent(proxyUrl);
-    
-    const response = await axios.get('https://httpbin.org/get', {
-      httpsAgent: agent,
-      timeout: 10000,
-      headers: {
-        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
-      }
-    });
-    
-    console.log(`   ✅ SOCKS5代理测试成功: ${response.status}`);
-    console.log(`   IP: ${response.data.origin}`);
-  } catch (error) {
-    console.log(`   ❌ SOCKS5代理测试失败: ${error.message}`);
-  }
-}
-
-// 主函数
-async function main() {
-  const directSuccess = await testDirect();
-  
-  if (!directSuccess) {
-    console.log('\n⚠️  直连测试失败,请检查网络连接');
-    console.log('可能的原因:');
-    console.log('- 网络连接问题');
-    console.log('- 防火墙阻止');
-    console.log('- DNS解析问题');
-    return;
-  }
-  
-  await testLocalProxy();
-  await testHttpProxy();
-  await testSocks5Proxy();
-  
-  console.log('\n📋 测试完成');
-  console.log('如果直连成功但代理测试失败,说明:');
-  console.log('1. 代理服务未运行');
-  console.log('2. 代理端口配置错误');
-  console.log('3. 代理配置有问题');
-}
-
-main().catch(console.error); 

+ 0 - 77
test-subscription-content.js

@@ -1,77 +0,0 @@
-const axios = require('axios');
-const yaml = require('yaml');
-
-async function testSubscription() {
-  const subscriptionUrl = 'http://so.xfxssr.me/api/v1/client/subscribe?token=7854d59f38ac51700730b9e782c5160c';
-  
-  try {
-    console.log('🔍 测试订阅URL...');
-    console.log(`URL: ${subscriptionUrl}\n`);
-    
-    const response = await axios.get(subscriptionUrl, {
-      timeout: 30000,
-      headers: {
-        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
-      }
-    });
-
-    console.log('✅ 成功获取响应');
-    console.log(`状态码: ${response.status}`);
-    console.log(`内容长度: ${response.data.length} 字符`);
-    console.log(`内容类型: ${response.headers['content-type'] || '未知'}\n`);
-
-    // 显示前500个字符
-    console.log('📄 响应内容预览 (前500字符):');
-    console.log('='.repeat(50));
-    console.log(response.data.substring(0, 500));
-    console.log('='.repeat(50));
-    console.log();
-
-    // 尝试解析为YAML
-    try {
-      console.log('🔄 尝试解析为YAML...');
-      const config = yaml.parse(response.data);
-      
-      if (config.proxies && Array.isArray(config.proxies)) {
-        console.log(`✅ 成功解析YAML,找到 ${config.proxies.length} 个代理节点`);
-        
-        // 显示前几个节点的信息
-        console.log('\n📋 前3个节点信息:');
-        config.proxies.slice(0, 3).forEach((proxy, index) => {
-          console.log(`${index + 1}. ${proxy.name} (${proxy.type}) - ${proxy.server}:${proxy.port}`);
-        });
-      } else {
-        console.log('❌ YAML解析成功,但没有找到proxies数组');
-        console.log('配置键:', Object.keys(config));
-      }
-    } catch (yamlError) {
-      console.log('❌ YAML解析失败:', yamlError.message);
-      
-      // 尝试Base64解码
-      try {
-        console.log('\n🔄 尝试Base64解码...');
-        const decoded = Buffer.from(response.data, 'base64').toString('utf8');
-        console.log('✅ Base64解码成功');
-        console.log('解码后内容长度:', decoded.length);
-        
-        const config = yaml.parse(decoded);
-        if (config.proxies && Array.isArray(config.proxies)) {
-          console.log(`✅ 成功解析Base64解码后的YAML,找到 ${config.proxies.length} 个代理节点`);
-        } else {
-          console.log('❌ Base64解码后仍没有找到proxies数组');
-        }
-      } catch (base64Error) {
-        console.log('❌ Base64解码失败:', base64Error.message);
-      }
-    }
-
-  } catch (error) {
-    console.error('❌ 请求失败:', error.message);
-    if (error.response) {
-      console.error('状态码:', error.response.status);
-      console.error('响应头:', error.response.headers);
-    }
-  }
-}
-
-testSubscription(); 

+ 0 - 61
test-subscription.js

@@ -1,61 +0,0 @@
-#!/usr/bin/env node
-
-require('dotenv').config();
-const SubscriptionManager = require('./src/core/subscriptionManager');
-const logger = require('./src/utils/logger');
-
-async function testSubscription() {
-  console.log('🧪 测试订阅功能...\n');
-
-  try {
-    const subscriptionManager = new SubscriptionManager();
-    
-    console.log('📋 订阅配置信息:');
-    console.log(`   订阅地址: ${subscriptionManager.subscriptionUrl}`);
-    console.log(`   更新间隔: ${subscriptionManager.updateInterval / 1000}秒\n`);
-
-    console.log('🔄 开始获取订阅配置...');
-    const config = await subscriptionManager.fetchSubscription();
-    
-    console.log('✅ 订阅配置获取成功!');
-    console.log(`   节点数量: ${config.proxies.length}`);
-    
-    console.log('\n📊 节点类型统计:');
-    const typeStats = {};
-    config.proxies.forEach(proxy => {
-      typeStats[proxy.type] = (typeStats[proxy.type] || 0) + 1;
-    });
-    
-    Object.entries(typeStats).forEach(([type, count]) => {
-      console.log(`   ${type}: ${count}个`);
-    });
-
-    console.log('\n🔍 前5个节点信息:');
-    config.proxies.slice(0, 5).forEach((proxy, index) => {
-      console.log(`   ${index + 1}. ${proxy.name} (${proxy.type}) - ${proxy.server}:${proxy.port}`);
-    });
-
-    console.log('\n🔄 开始更新节点列表...');
-    const result = await subscriptionManager.updateNodes();
-    
-    console.log('✅ 节点列表更新完成!');
-    console.log(`   总节点数: ${result.updated}`);
-    console.log(`   新增节点: ${result.added}`);
-    console.log(`   更新节点: ${result.updated - result.added}`);
-    console.log(`   移除节点: ${result.removed}`);
-
-    console.log('\n🎉 订阅功能测试完成!');
-
-  } catch (error) {
-    console.error('❌ 订阅测试失败:', error.message);
-    console.error('   详细错误:', error);
-    process.exit(1);
-  }
-}
-
-// 如果直接运行此文件
-if (require.main === module) {
-  testSubscription();
-}
-
-module.exports = { testSubscription }; 

+ 0 - 110
test-telegram.js

@@ -1,110 +0,0 @@
-#!/usr/bin/env node
-
-require('dotenv').config();
-const TelegramBot = require('node-telegram-bot-api');
-const logger = require('./src/utils/logger');
-
-async function testTelegram() {
-  console.log('🤖 测试Telegram机器人...\n');
-
-  const botToken = process.env.TELEGRAM_BOT_TOKEN;
-  const chatId = process.env.TELEGRAM_CHAT_ID;
-
-  if (!botToken) {
-    console.error('❌ 未配置TELEGRAM_BOT_TOKEN');
-    process.exit(1);
-  }
-
-  if (!chatId) {
-    console.error('❌ 未配置TELEGRAM_CHAT_ID');
-    console.log('\n📋 如何获取Chat ID:');
-    console.log('   1. 将机器人添加到群组或频道');
-    console.log('   2. 在群组中发送 /start');
-    console.log('   3. 访问: https://api.telegram.org/bot' + botToken + '/getUpdates');
-    console.log('   4. 查找 "chat" 对象中的 "id" 字段');
-    process.exit(1);
-  }
-
-  try {
-    console.log('📋 机器人配置信息:');
-    console.log(`   Bot Token: ${botToken.substring(0, 10)}...${botToken.substring(botToken.length - 10)}`);
-    console.log(`   Chat ID: ${chatId}\n`);
-
-    // 创建机器人实例
-    const bot = new TelegramBot(botToken, { polling: false });
-
-    console.log('🔄 测试机器人连接...');
-    const me = await bot.getMe();
-    console.log('✅ 机器人连接成功!');
-    console.log(`   机器人名称: ${me.first_name}`);
-    console.log(`   机器人用户名: @${me.username}`);
-    console.log(`   机器人ID: ${me.id}\n`);
-
-    console.log('🔄 测试发送消息...');
-    const testMessage = `🧪 测试消息
-
-时间: ${new Date().toLocaleString('zh-CN')}
-状态: 机器人连接正常
-功能: Clash节点测速工具
-
-如果您收到此消息,说明Telegram通知功能配置成功!`;
-
-    const sentMessage = await bot.sendMessage(chatId, testMessage, {
-      parse_mode: 'Markdown',
-      disable_web_page_preview: true
-    });
-
-    console.log('✅ 消息发送成功!');
-    console.log(`   消息ID: ${sentMessage.message_id}`);
-    console.log(`   发送时间: ${new Date(sentMessage.date * 1000).toLocaleString('zh-CN')}\n`);
-
-    console.log('🔄 测试格式化消息...');
-    const formattedMessage = `🚨 *节点故障通知*
-
-*节点名称:* 测试节点
-*节点类型:* ss
-*服务器:* 1.2.3.4:8388
-*分组:* 测试分组
-*连续失败次数:* 3
-*最后测试时间:* ${new Date().toLocaleString('zh-CN')}
-*错误信息:* 连接超时
-*测试耗时:* 5000ms`;
-
-    const formattedSentMessage = await bot.sendMessage(chatId, formattedMessage, {
-      parse_mode: 'Markdown',
-      disable_web_page_preview: true
-    });
-
-    console.log('✅ 格式化消息发送成功!');
-    console.log(`   消息ID: ${formattedSentMessage.message_id}\n`);
-
-    console.log('🎉 Telegram机器人测试完成!');
-    console.log('\n📝 测试结果:');
-    console.log('   ✅ 机器人连接正常');
-    console.log('   ✅ 消息发送功能正常');
-    console.log('   ✅ 格式化消息功能正常');
-    console.log('   ✅ 通知功能已就绪');
-
-  } catch (error) {
-    console.error('❌ Telegram测试失败:', error.message);
-    
-    if (error.response) {
-      console.error('   错误详情:', error.response.data);
-    }
-    
-    console.log('\n🔧 故障排除建议:');
-    console.log('   1. 检查Bot Token是否正确');
-    console.log('   2. 检查Chat ID是否正确');
-    console.log('   3. 确保机器人已添加到目标群组/频道');
-    console.log('   4. 确保机器人有发送消息权限');
-    
-    process.exit(1);
-  }
-}
-
-// 如果直接运行此文件
-if (require.main === module) {
-  testTelegram();
-}
-
-module.exports = { testTelegram };