-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Support dynamic management of peers #6296
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
Comments
This feature looks very good, but I still have a question, if the connection of the specified peer is disconnected, will the reconnection request be accepted? |
@fyyhtx Yes, a peer that is designated to be disconnected can be re-accepted, but only after it has passed the banding period. One thing to be clear is that we are not implementing a blacklist feature. |
I tried to add active nodes and passive nodes without restarting the nodes, but it didn't seem to work. Is there a problem with the dynamic loading of configuration files function? Or does the dynamic loading of configuration files function need to be enabled? |
@jakamobiii I guess you may not have enabled the dynamic configuration file loading function. You can set the configuration item |
@jwrct Do you want to specify the peer you want to delete through configuration? As you said, the disconnected peer can still be accepted later. When you want to delete a peer again, but it already exists in the configuration, how to deal with this situation? |
@jwrct For Ethereum the |
@Sunny6889 For the RemovePeer action of Ethereum, it will not be put into the blacklist and the connection can be established again later. |
@jwrct So does it means Ethereum also does not have a blacklist feature? |
@Sunny6889 Yes, I think so. I have checked the Ethereum code implementation and found nothing about it. If you have any new findings, please provide some clues, I will be very grateful. |
@fyyhtx Yes, by default, a new configuration file is loaded every 10 minutes. You can delete the peer information from the configuration after confirming that the peer has been deleted, or remove the existing configuration before deleting the peer, and wait 10 minutes before deleting the peer. |
@jwrct Is there already a specific implementation plan? If so, could you share it with everyone for discussion to better optimize the plan? |
@fyyhtx Yes, you're right. I already have an initial plan here:
|
@jwrct You proposed to pass in the network address of the peer you want to delete by dynamically loading the configuration. I have to admit that this method is the simplest one to implement at present. However, I would like to say that this method has a disadvantage, that is, you need to log in to the server where the node is located every time, which may not be the most convenient way for some node operators. |
@fyyhtx Your concerns are reasonable. Ethereum implements the peer you want to delete through an API with permission control. This method is indeed much more convenient for node operators. However, java-tron currently does not implement permission control for the API. We can consider implementing this first, and then specify the peer to be deleted in this way. |
@jwrct I think it is better to implement API permission control first, and then specify the peer to be deleted through the API. I hope it will be implemented soon. |
@fyyhtx I am very happy to receive your suggestions. If there is any progress, I will announce it here in time and adjust the implementation plan in the text in time. Thank you again! |
I have initially implemented a version of the code to specify the peer to be removed through the API, but the newly added API has not yet been given permission control, which will be added later. For the specific code, please refer to: jwrct@9919bd6 |
@jwrct A JWT-like authentication scheme is currently being designed, and we can collaborate on it later. |
@317787106 I am very excited to see your reply and look forward to collaborating with you. |
If there is no update i suggest to close the issue |
Milestone Update (2025-05-27)
|
Uh oh!
There was an error while loading. Please reload this page.
Background
Java-tron currently does not support node operators to flexibly manage the peer list of a node. For example, when a node operator wants to disconnect a peer (this peer may have a large network delay, or is inactive, etc.), there is no better way than restarting the node. Obviously, restarting the node is not a wise choice, because it will have a relatively large impact on other services that rely on the normal operation of the node. Moreover, after restarting the node, the node that you want to disconnect may still be able to quickly connect to the local node. Therefore, it is necessary for java-tron to implement the function of dynamically managing the peer list of nodes to provide node operators with more options for better node management.
Rationale
By looking at the implementation of Ethereum, it is found that Ethereum implements the following interfaces:
Currently, java-tron already supports dynamic addition and deletion of active nodes and passive nodes by dynamically loading configuration files.
Therefore, we can dynamically delete peers by dynamically loading configuration files.
Implementation
Add a new configuration item node.removePeers in the configuration file:
node.removePeers = [ "ip1:port", "ip2:port" ]
node.removePeers configures dynamic update logic:
When the node starts, node.removePeers is loaded normally.
When the configuration file is loaded dynamically, the latest node.removePeers is loaded and the network address list in the configuration is traversed:
a. Check whether the network address exists in the last cache removePeers. If it does, get the peer according to the network address. If it is successfully obtained, send a disconnect message to the peer with the reason code USER_REASON and disconnect.
b. No processing is done in other cases.
Update the latest removePeers list to the cache.
Do you have ideas regarding the implementation of this feature?
yes
Are you willing to implement this feature?
yes
The text was updated successfully, but these errors were encountered: