Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NTMinerNoDevFee: fix #131, restrict port to improve passthrough performance #143

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ThunderEX
Copy link
Contributor

NTMinerNoDevFee原有的filter是
outbound && ip && ip.DstAddr != 127.0.0.1 && tcp && tcp.PayloadLength > 100
这样很大一部分出站的包都要经过NTMinerNoDevFee,拖慢了系统的性能。

这个改动把各内核命令行参数里的矿池地址和端口抓了出来,应用到WinDivert的filter上,使得大多数无关的包不会被WinDivert拦截。
这里我虽然抓了矿池的地址和端口,但filter只应用了端口,原因是地址有时会被DNS解析到不同的IP地址,所以filter要加地址的话还要DNS查询出所有的IP,麻烦一点。所以只是预留了但实际并没有用。此外,实际测试下来,filter加上端口号后性能已经基本不受影响了。

@ntminer
Copy link
Owner

ntminer commented May 13, 2021

有个问题是老外内核作者的抽水矿池不一定是用的矿工选择的矿池,比如PhoenixMiner不是使用的用户使用的矿池抽水的,Claymore在挖非ETH币种时或者使用用户名挖矿时也不是使用的用户使用的矿池抽水的,所以矿池地址和端口号是假定不知道的。你可以根据需求改改代码重新编译只要不重新分发就没有什么问题。

@ThunderEX
Copy link
Contributor Author

@ntminer 我之前用的是PhoenixMiner和鱼池,看log里抽水就是鱼池和鱼池的6688端口,只不过鱼池的域名有时会被解析到不同的IP。至于Claymore我还没有测试。
不过我还是改了一下,现在不用地址和端口号做filter了,我看了一下Stratum协议其实是TCP上的json-rpc,所以直接过滤出报文以"{"开头,以"}\n"结尾的就行了。具体请看我更新后的这个PR。
不过有一个小问题,WinDivert 2.0以上才支持tcp.Payload[i]。所以我升级了WinDivert,但是:

  1. src\NTMinerNoDevFee\NoDevFee\WinDivert.cs是WinDivert的接口,我还没空把2.0版本的更新都改过来,一部分没用到的接口我直接注释掉了,
  2. WinDivert64.sys这个驱动好像现在的WinDivertExtract.cs不能用新版的替换旧版的,可能因为这个驱动开机就加载了。我自己直接手工删掉了,实际版本升级时或许会有一点问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants