设为首页收藏本站

ZMX - IT技术交流论坛 - 无限Perfect,追求梦想 - itzmx.com

 找回密码
 注册论坛

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

用百度帐号登录

只需两步,快速登录

搜索
查看: 62|回复: 9

NexusPHP1.5 如PT客户端有V4V6地址,做种汇报数据问题

[复制链接]

签到天数: 249 天

[LV.8]以坛为家I

发表于 2024/10/16 08:32 | 显示全部楼层 |阅读模式 |Google Chrome 109.0.0.0|Windows 10
天涯海角搜一下: 百度 谷歌 360 搜狗 有道 雅虎 必应 即刻
在NP1.5程序,如PT客户端同时有V4V6地址,做种汇报数据会翻倍的,如上传量下载量

在种子详情,同伴出现这样
161.jpg


这个,如何解决呢
欢迎光临IT技术交流论坛:http://bbs.itzmx.com/
回复

使用道具 举报

 成长值: 138

签到天数: 4671 天

[LV.Master]伴坛终老

发表于 2024/10/16 19:11 | 显示全部楼层 |Google Chrome 129.0.0.0|Windows 10
有些NexusPHP的pt站点禁用qbittorrent就是这个原因,多次重复汇报数据
https://bbs.itzmx.com/thread-98030-1-1.html

不过按理来说原版NexusPHP不会发生这种现象,除非qb多次重复汇报的时候还去主动改变了peerid
正常来说第一次汇报是ipv4,第二次汇报是ipv6,那么NexusPHP会重写原有客户端的ip地址改为新的ipv6

要不然在域名上把v6的aaaa解析删掉也可以解决
其实也微乎其微,私有种子用户群毕竟小,影响不算特别大,建立ipv6成功后会通过 bittorrent.peer_dual_ip 返回自身ipv4给对方
不过这个返回有个前提是建立成功,在成功之前不知道对方2个ip地址中的另一个ip地址,此时可能因为端口未打开引起建立失败无法进行交换ip信息
虽然同时汇报A和AAAA是最终解决办法,但是tracker服务器并不承认一个peerid拥有2个地址,甚至可能因为双次请求拉黑名单

[发帖际遇]: 小樱 发帖时在路边捡到 1 樱币,偷偷放进了口袋. 幸运榜 / 衰神榜
欢迎光临IT技术交流论坛:http://bbs.itzmx.com/
回复 支持 反对

使用道具 举报

签到天数: 249 天

[LV.8]以坛为家I

 楼主| 发表于 2024/10/16 22:48 | 显示全部楼层 |Google Chrome 109.0.0.0|Windows 10
域名没解析V6. 这有什么好的方法解决呢
欢迎光临IT技术交流论坛:http://bbs.itzmx.com/
回复 支持 反对

使用道具 举报

 成长值: 138

签到天数: 4671 天

[LV.Master]伴坛终老

发表于 2024/10/17 04:23 | 显示全部楼层 |Google Chrome 129.0.0.0|Windows 10
308760841 发表于 2024/10/16 22:48
域名没解析V6. 这有什么好的方法解决呢


那可能是站点使用了CDN,然后用户通过hosts文件绑定了ipv6的节点服务器到域名上,可以在CDN或者源站上做个检测,访问地址是ipv6就禁止
如果是使用CF cloudflare,可以用waf功能,匹配"IP 源地址"
值填写
中国电信
  1. 240e::/16
复制代码

中国联通
  1. 2408::/16
复制代码

中国移动
  1. 2409::/16
复制代码


https://developers.cloudflare.com/waf/tools/lists/custom-lists/
https://developers.cloudflare.com/waf/tools/ip-access-rules/parameters/

但是屏蔽ipv6访问不是最好的解决办法,而是要找到php文件中哪里有问题将其修复才是正确的,比如说对比下当前站点使用的文件与原版NexusPHP的差异

欢迎光临IT技术交流论坛:http://bbs.itzmx.com/
回复 支持 反对

使用道具 举报

签到天数: 249 天

[LV.8]以坛为家I

 楼主| 发表于 2024/10/17 08:33 | 显示全部楼层 |Google Chrome 109.0.0.0|Windows 10
应该是NP1.5的bug, 不关CDN的事, 2019年,那时流行双宽带叠加。如会员双宽带叠加,有双IP,上传汇报数据也是翻倍的,上传速度超100M被封号
欢迎光临IT技术交流论坛:http://bbs.itzmx.com/
回复 支持 反对

使用道具 举报

 成长值: 138

签到天数: 4671 天

[LV.Master]伴坛终老

发表于 2024/10/17 19:14 | 显示全部楼层 |Google Chrome 129.0.0.0|Windows 10
308760841 发表于 2024/10/17 08:33
应该是NP1.5的bug, 不关CDN的事, 2019年,那时流行双宽带叠加。如会员双宽带叠加,有双IP,上传汇报数据 ...


使用NexusPHP原版测试没有这个bug,无法复现,就算ip地址在多频繁切换ip,也只会记录一条ip数据
你先对比下 announce.php 文件是否有不同
记得点回复按钮,不然收不到回复提醒
欢迎光临IT技术交流论坛:http://bbs.itzmx.com/
回复 支持 反对

使用道具 举报

签到天数: 249 天

[LV.8]以坛为家I

 楼主| 发表于 2024/10/17 22:13 | 显示全部楼层 |Google Chrome 109.0.0.0|Windows 10
对比announce.php,基本不变,只是在最后加VIP不计下载量与种子认领
  1. if (count($updateset)) // Update only when there is change in peer counts
  2. {
  3.         $updateset[] = "visible = 'yes'";
  4.         $updateset[] = "last_action = $dt";
  5.         sql_query("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $torrentid");
  6. }

  7. if($client_familyid != 0 && $client_familyid != $az['clientselect']){//20221119
  8.         $USERUPDATESET[] = "clientselect = ".sqlesc($client_familyid);
  9. }       
  10. /**
  11. * VIP do not calculate downloaded
  12. * @since 20221119
  13. */
  14. if ($az['class'] == UC_VIP) {
  15.     foreach ($USERUPDATESET as $key => $value) {
  16.         if (preg_match("/downloaded/i", $value)) {
  17.             unset($USERUPDATESET[$key]);
  18.         }
  19.     }
  20. }
  21. if(count($USERUPDATESET) && $userid)
  22. {
  23.         sql_query("UPDATE users SET " . join(",", $USERUPDATESET) . " WHERE id = ".$userid);
  24.         //种子认领20181127
  25.         //sql_query("UPDATE my_torrents_claim SET  m_up=m_up+".($trueupthis+0)." ,m_down=m_down+".(0+$truedownthis)." ,m_seedtime=m_seedtime+".($self['announcetime']+0)." WHERE torrent_id = $torrentid and user_id =  $userid");
  26.     //20181210new
  27.         sql_query("UPDATE my_torrents_claim SET  m_up=m_up+".($trueupthis+0)." ,m_down=m_down+".(0+$truedownthis)." WHERE torrent_id = $torrentid and user_id =  $userid");
  28.        
  29. }
  30. if($userid)
  31. {
  32.     //20181210种子认领做种时间
  33.         //20181210 update 20181211
  34.         $m_res = @mysql_fetch_array(@sql_query("SELECT uploaded,downloaded,started,last_action,prev_action FROM peers WHERE torrent=$torrentid AND seeder ='yes' AND userid=" . sqlesc($userid)));
  35.         $prev_action = strtotime($m_res['prev_action']);
  36.         if($prev_action>0){
  37.                 $m_seedtime = strtotime($m_res['last_action'])-strtotime($m_res['prev_action']);
  38.                 sql_query("UPDATE my_torrents_claim SET  m_seedtime=m_seedtime+".($m_seedtime+0)." WHERE torrent_id = $torrentid and user_id =  $userid");
  39.         }else{
  40.                 $m_seedtime = strtotime($m_res['last_action'])-strtotime($m_res['started']);
  41.                 sql_query("UPDATE my_torrents_claim SET  m_seedtime=m_seedtime+".($m_seedtime+0)." WHERE torrent_id = $torrentid and user_id =  $userid");
  42.         }
  43.        
  44. }
  45. benc_resp_raw($resp);
复制代码


不是切换IP,要客户端同时有2个IP才汇报数据翻倍的
欢迎光临IT技术交流论坛:http://bbs.itzmx.com/
回复 支持 反对

使用道具 举报

 成长值: 138

签到天数: 4671 天

[LV.Master]伴坛终老

发表于 2024/10/18 00:32 | 显示全部楼层 |Google Chrome 129.0.0.0|Windows 10
308760841 发表于 2024/10/17 22:13
对比announce.php,基本不变,只是在最后加VIP不计下载量与种子认领


对的,我说的就是客户端有多个ip的意思
你这段代码有很多次套娃my_torrents_claim操作,增加上传(m_up)和下载(m_down)数据,可以确定就是这段代码的问题
在20181210new这一段里面,后面的UPDATE操作没有注释掉,后续产生的if($userid)重复几次看起来挺可疑的,应该是这个引起的?要找个php大佬确认一下这段代码怎么修复,下方这份修复代码这可能报错500无法正常工作,由于代码中涉及到数据库更新,注意备份数据库在尝试。
  1. if (count($updateset)) {
  2.     $updateset[] = "visible = 'yes'";
  3.     $updateset[] = "last_action = $dt";
  4.     sql_query("UPDATE torrents SET " . join(",", $updateset) . " WHERE id = $torrentid");
  5. }

  6. if ($client_familyid != 0 && $client_familyid != $az['clientselect']) {
  7.     $USERUPDATESET[] = "clientselect = ".sqlesc($client_familyid);
  8. }

  9. if ($az['class'] == UC_VIP) {
  10.     foreach ($USERUPDATESET as $key => $value) {
  11.         if (preg_match("/downloaded/i", $value)) {
  12.             unset($USERUPDATESET[$key]);
  13.         }
  14.     }
  15. }

  16. if (count($USERUPDATESET) && $userid) {
  17.     sql_query("UPDATE users SET " . join(",", $USERUPDATESET) . " WHERE id = ".$userid);

  18.     $torrentsClaimUpdate = "m_up=m_up+".($trueupthis+0).", m_down=m_down+".(0+$truedownthis);
  19.     sql_query("UPDATE my_torrents_claim SET $torrentsClaimUpdate WHERE torrent_id = $torrentid and user_id =  $userid");
  20. }

  21. if ($userid) {
  22.     $m_res = @mysql_fetch_array(@sql_query("SELECT uploaded, downloaded, started, last_action, prev_action FROM peers WHERE torrent=$torrentid AND seeder ='yes' AND userid=" . sqlesc($userid)));
  23.     $prev_action = strtotime($m_res['prev_action']);
  24.     if ($prev_action > 0) {
  25.         $m_seedtime = strtotime($m_res['last_action']) - $prev_action;
  26.     } else {
  27.         $m_seedtime = strtotime($m_res['last_action']) - strtotime($m_res['started']);
  28.     }
  29.    
  30.     if ($m_seedtime > 0) {
  31.         sql_query("UPDATE my_torrents_claim SET m_seedtime=m_seedtime+".($m_seedtime+0)." WHERE torrent_id = $torrentid and user_id =  $userid");
  32.     }
  33. }

  34. benc_resp_raw($resp);
复制代码

欢迎光临IT技术交流论坛:http://bbs.itzmx.com/
回复 支持 反对

使用道具 举报

签到天数: 249 天

[LV.8]以坛为家I

 楼主| 发表于 2024/10/18 10:18 | 显示全部楼层 |Google Chrome 109.0.0.0|Windows 10
  1. sql_query("UPDATE my_torrents_claim SET  m_up=m_up+".($trueupthis+0)." ,m_down=m_down+".(0+$truedownthis)." WHERE torrent_id = $torrentid and user_id =  $userid");
复制代码

改成
  1. $torrentsClaimUpdate = "m_up=m_up+".($trueupthis+0).", m_down=m_down+".(0+$truedownthis);
  2.     sql_query("UPDATE my_torrents_claim SET $torrentsClaimUpdate WHERE torrent_id = $torrentid and user_id =  $userid");
复制代码

是吗
欢迎光临IT技术交流论坛:http://bbs.itzmx.com/
回复 支持 反对

使用道具 举报

签到天数: 249 天

[LV.8]以坛为家I

 楼主| 发表于 2024/10/18 10:37 | 显示全部楼层 |Google Chrome 109.0.0.0|Windows 10
我想不是这个问题。记得某会员在2019年,双宽带的,在天空站(HDSKY)也是超速度封号
欢迎光临IT技术交流论坛:http://bbs.itzmx.com/
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册论坛 新浪微博账号登陆用百度帐号登录

本版积分规则

手机版|Archiver|Mail me|网站地图|IT技术交流论坛 ( 闽ICP备13013206号-7 )

GMT+8, 2024/10/18 11:28 , Processed in 0.131655 second(s), 20 queries , MemCache On.

Powered by itzmx! X3.4

© 2011- sakura

快速回复 返回顶部 返回列表