Open weiqiushi opened 1 year ago
Hi, the code for this feature has been submitted to the 853d4c88fe552c06661b56f4f64a8a37e528f7c1 of Git.
Assuming that the remote host is u1 and the local host is u2, with the IP addresses of 192.168.10.100 and 192.168.20.100, respectively.
On u2, with the certificate of u1 named u1.desc available, the following steps are taken to determine the BDT connectivity to u1:
1.Compile the debug program cargo build --release -p bdt-debuger-deamon cargo build --release -p bdt-debuger
Copy bdt-debugger-daemon and bdt-debugger to u2, and put sn-miner.desc, sn-miner.sec, u1.desc, and u1.sec into the same directory.
2.Start the local debug program on u2 ./bdt-debuger-deamon --listen 2021 --port 12345 --ep L4udp192.168.20.100:8060 --quiet 0
3.Perform ping debugging ./bdt-debuger -h 127.0.0.1 -p 12345 ping u1.desc 3 3
4.The results
Online, ping successfully: send ping. respose. time: 10.3 ms send ping. respose. time: 1.9 ms send ping. respose. time: 2.0 ms
Offline, ping failed: send ping. timeout send ping. timeout send ping. timeout For more error information, please check the log file.
Great Job! But why need 2 programs to test bdt prorocol stack? Is it possible use single program to test it? And If I want to initialize the local BDT stack with a SN list, how do I do it? @jing-git
Hello. It is inconvenient to debug the BDT protocol stack using only one program. The bdt-debuger-deamon integrates all the functions of the BDT protocol stack and outputs logs during runtime. bdt-debuger serves as a bridge between bdt-debuger-deamon and the user, transmitting commands to bdt-debuger-deamon for execution and displaying the results. Currently, if there is only one program(bdt-debuger-deamon), the logs and inputs during runtime will be mixed together, which can affect the interaction.
And the feature to load multiple SNs will be added later.
Hi, you can initialize the local BDT stack with a SN list now. For bdt-debuger-deamon: ./bdt-debuger-deamon --sn sn1.desc --sn sn2.desc ......
Hi, you can initialize the local BDT stack with a SN list now. For bdt-debuger-deamon: ./bdt-debuger-deamon --sn sn1.desc --sn sn2.desc ......
Is this tool available for use now? Are there any detailed usage processes and instructions?
Hi, you can initialize the local BDT stack with a SN list now. For bdt-debuger-deamon: ./bdt-debuger-deamon --sn sn1.desc --sn sn2.desc ......
Is this tool available for use now? Are there any detailed usage processes and instructions?
Yes, both bdt-debuger-deamon and bdt-debuger are available. For specific usage, please refer to the document at https://github.com/buckyos/documents/blob/main/bdt/en/9.Debug.md. Additional features will be added in the future, and any changes in usage will be updated in this document.
Hi, you can initialize the local BDT stack with a SN list now. For bdt-debuger-deamon: ./bdt-debuger-deamon --sn sn1.desc --sn sn2.desc ......
Is this tool available for use now? Are there any detailed usage processes and instructions?
Yes, both bdt-debuger-deamon and bdt-debuger are available. For specific usage, please refer to the document at https://github.com/buckyos/documents/blob/main/bdt/en/9.Debug.md. Additional features will be added in the future, and any changes in usage will be updated in this document.
A nice tool, thank you for providing it! I will give it a try with my OOD.
@jing-git I want to integrate this function into the cyfs-monitor program to detect whether a given OOD is connectable or not. What would be the best way for me to do this?
There is a key question The tool itself is similar to nc/ping tool in nix, why do you need a daemon and a tool, so that the mental cost of using it is too high for the user, and the multi-process coordinated start and use itself is very unfriendly, as a tool, all logic should be integrated into an executable program, convenient for distribution to users and users to use
I think you can refer to the design of cyfs-meta-client and cyfs-meta-lib.
cyfs-meta-lib is a rust lib, and this lib defines the MetaClient structure. By constructing the MetaClient example. Third-party programs can interact with the Meta chain through the interface of this instance
Further, cyfs-meta-client is a command line tool through which it is possible to interact with the MetaChain in a shell.
This tool has several functions, but the logic of implementing each function is similar: 1:
What is the purpose of this BDT tool?
As a network protocol testing tool, if it is only used to diagnose the running status of the server, we can use simple bdt client tools like ping/nc to achieve it, in order to diagnose whether the server BDT protocol can be connected correctly.
But if this tool is used to diagnose the connectivity and data transmission performance of BDT between two nodes, we need more professional testing tools, such as iperf, and specify whether to run as a client or server using -c and -s.
It seems that the current implementation leans towards providing a server + client tool that is similar to iperf for professional users. However, the daemon and debug programs can be combined into one program.
For example nc:
For example iperf:
What is the purpose of this BDT tool?
As a network protocol testing tool, if it is only used to diagnose the running status of the server, we can use simple client tools such as ping/nc to achieve it, in order to diagnose whether the server BDT protocol can be connected correctly.
But if this tool is used to diagnose the connectivity and data transmission performance of BDT between two nodes, we need more professional testing tools, such as iperf, and specify whether to run as a client or server using -c and -s.
It seems that the current implementation leans towards providing a server + client tool that is similar to iperf for professional users. However, the daemon and debug programs can be combined into one program.
For example nc:
For example iperf:
How do you test the connectivity between the local machine and an already started, BDT stack via nc? I think only BDT provides a specific tool to test
What is the purpose of this BDT tool?
As a network protocol testing tool, if it is only used to diagnose the running status of the server, we can use simple bdt client tools like ping/nc to achieve it, in order to diagnose whether the server BDT protocol can be connected correctly.
But if this tool is used to diagnose the connectivity and data transmission performance of BDT between two nodes, we need more professional testing tools, such as iperf, and specify whether to run as a client or server using -c and -s.
It seems that the current implementation leans towards providing a server + client tool that is similar to iperf for professional users. However, the daemon and debug programs can be combined into one program.
For example nc:
For example iperf:
It mainly depends on the different levels of requirements
In the usual network situation, if a simple ping probe is needed for the target device, the other side just needs to run the bdt protocol stack (usually gateway/cyfs-runtime these basic services) is enough, but the amount of information that can be obtained by this kind of diagnosis is certainly also relatively small, but at least it can detect whether the connection can be made
From this point of view, the bdt protocol itself should support a similar ping echo protocol that can be used to support probing, and this feature is configurable, and in some cases in the security point of view can also be turned off @photosssa
The advanced features of the connection between two peers, this is from the perspective of testing/advanced users, such as testing the stability of the link, testing the performance of the bdt protocol, stability, in this case it is necessary to deploy the corresponding special tool components at both ends, but there is no contradiction with the ping tool mentioned in 1
@jing-git I want to integrate this function into the cyfs-monitor program to detect whether a given OOD is connectable or not. What would be the best way for me to do this?
hello, you can directly use the ping interface of Pinger.:https://github.com/buckyos/CYFS/blob/main/src/component/cyfs-bdt/src/debug/ping.rs example:
/*
stack: WeakStack
remote: Device
timeout: Duration
*/
let pinger = Pinger::open(stack.clone()).unwrap();
match pinger.ping(remote.clone(), timeout, "debug".as_ref()).await {
Ok(rtt) => {
match rtt {
Some(rtt) => {
println!("ping success, rtt is {:.2} ms", rtt as f64 / 1000.0);
},
None => {
println!("connected, but ping's seq mismatch");
}
}
},
Err(e) => {
println!("ping err={}", e);
}
}
There is a key question The tool itself is similar to nc/ping tool in nix, why do you need a daemon and a tool, so that the mental cost of using it is too high for the user, and the multi-process coordinated start and use itself is very unfriendly, as a tool, all logic should be integrated into an executable program, convenient for distribution to users and users to use
The previous design was more focused on debugging and observing the running process. For ease of use, i will combine the daemon and debugger into one program later, which can directly receive commands, process them, and return results.
Hello, you can use easier-to-use tool right now. It provides ping and nc functions to quickly check the connectivity of the peer device and has only one program.
compile: cargo build --release -p bdt-tool
Command line: ./bdt-tool --ep BDTStackAddress [--sn SN's Desc, default is sn-miner.desc] [--log_level none/info/debug/error, default is none] --cmd [ping/nc parameters]
Examples: Running Environment: Local BDT Stack address: 192.168.200.100:8060 tcp&udp Remote device's desc: u1.desc Remote device open a stream on VPort 2023 SNs' desc: sn1.desc & sn2.desc
ping ./bdt-tool --ep L4udp192.168.20.100:8060 --ep L4tcp192.168.20.100:8060 --sn sn1.desc --sn sn2.desc --cmd ping u1.desc 3 3 Results: ping success, rtt is 7.46 ms ping success, rtt is 1.54 ms ping success, rtt is 1.58 ms
nc ./bdt-tool --ep L4udp192.168.20.100:8060 --ep L4tcp192.168.20.100:8060 --sn sn1.desc --sn sn2.desc --cmd nc u1.desc 2023 Results: connect vport=2021 success!
If you want to see more information about the running process, you can add the parameter log_level, like "--log_level info".
@jing-git I think you should put our beta and nighlty SN into the tool, other people may not know our complete SN List,You can set beta sn list default ,and use channel param to config it . beta.zip nightly.zip
So should we public the beta & nightly desc file
@jing-git I think you should put our beta and nighlty SN into the tool, other people may not know our complete SN List,You can set beta sn list default ,and use channel param to config it . beta.zip nightly.zip
Of course they can be integrated into the tool. @weiqiushi The CYFS protocol stack how to determine the beta and nightly environment, and then select the corresponding SN server, I refer to the implementation :)
@jing-git @lurenpluto I don't think the current bdt-tool is friendly for novice users to diagnose the BDT network.
Just like the traditional ping tool, there is no need for users to input their own IP and DNS host as this is handled internally by the tool,
And similarly, endpoints and SN lists can be embedded in the BDT-tool , Needn`t input
./bdt-tool ping device.desc
./bdt-tool ping 5aSixgLro2HUD6djQRT82dLdXNBjF7trBUczRu7piH9A
./bdt-tool ping device.desc --channel beta
./bdt-tool ping 5aSixgLro2HUD6djQRT82dLdXNBjF7trBUczRu7piH9A --channel beta
./bdt-tool ping device.desc --sn sn_miner1.desc --sn sn_miner2.desc
./bdt-tool ping 5aSixgLro2HUD6djQRT82dLdXNBjF7trBUczRu7piH9A --sn sn_miner1.desc --sn sn_miner2.desc
Hello, you can use easier-to-use tool right now. It provides ping and nc functions to quickly check the connectivity of the peer device and has only one program.
compile: cargo build --release -p bdt-tool
Command line: ./bdt-tool --ep BDTStackAddress [--sn SN's Desc, default is sn-miner.desc] [--log_level none/info/debug/error, default is none] --cmd [ping/nc parameters]
Examples: Running Environment: Local BDT Stack address: 192.168.200.100:8060 tcp&udp Remote device's desc: u1.desc Remote device open a stream on VPort 2023 SNs' desc: sn1.desc & sn2.desc
- ping ./bdt-tool --ep L4udp192.168.20.100:8060 --ep L4tcp192.168.20.100:8060 --sn sn1.desc --sn sn2.desc --cmd ping u1.desc 3 3 Results: ping success, rtt is 7.46 ms ping success, rtt is 1.54 ms ping success, rtt is 1.58 ms
- nc ./bdt-tool --ep L4udp192.168.20.100:8060 --ep L4tcp192.168.20.100:8060 --sn sn1.desc --sn sn2.desc --cmd nc u1.desc 2023 Results: connect vport=2021 success!
If you want to see more information about the running process, you can add the parameter log_level, like "--log_level info".
One of the key principles of our tool design is to put ourselves in the user's shoes, to make it simple enough to use, and not prone to ambiguity and confusion
The command line of the tool should be improved from the following perspectives. 1.
The use of bdt internal endpoint coding format, of course, this user can provide is the most accurate, but the general user does not know what the meaning of this, for the need for protocol + ip + port
as a parameter, you can refer to many mature tools such as nc how these are provided, --ep
can be used as an advanced parameter, to advanced and skilled users But the general user or to mention the more friendly parameters, otherwise this direct internal coding format is difficult to spell correctly
Our bdt protocol connection is based on device.desc, the endpoint list is only a part of it, so the most intuitive way for bdt tool to test the connection is to specify device.desc or device_id directly, which is the most consistent with the bdt protocol command line. PS: If you specify only device_id, you need to have the process of finding device.desc, you can use metachain and sn to find the target device.desc.
If sn is not explicitly specified in the parameters, then use the sn list on the corresponding meta chain, which we also have a fixed logic to pull the corresponding sn list
New features have been updated for bdt-tool, you can update the code and use it after compiling.
Usage example:
Try to ping device_id 5aSixgLro2HUD6djQRT82dLdXNBjF7trBUczRu7piH9A 3 times, timeout is 5 sec.
./bdt-tool --cmd ping 5aSixgLro2HUD6djQRT82dLdXNBjF7trBUczRu7piH9A 3 5
Try to connect device_id 5aSixgLro2HUD6djQRT82dLdXNBjF7trBUczRu7piH9A vport 2021.
./bdt-tool --cmd nc 5aSixgLro2HUD6djQRT82dLdXNBjF7trBUczRu7piH9A 2021
We need a tool to enter a DeviceId that can test the connectivity between the local machine and this DeviceId. In this way:
In addition, a simple Ping/Pong protocol can be used to test whether data can be transferred between BDT protocol stacks, and by extending the contents of the Pong return packet, it is also possible to