Open
Description
DHT Hardening
- Why we use hardening.
DhtRequest hardening is used for avoiding DoS attack.
A Tox node can be enter into Tox Network if the node can respond with valid PingResponse.
So, inserting many fake nodes can attack Tox Network to prevent two valid tox nodes can not connect to each other.
Hardening is used for defeating this attack.
- To implement hardening, we introduce new packet type named
CRYPTO_PACKET_HARDENING
which of value is48
. - We should extend existing
RequestQueue
struct to generic struct which is
From:
pub struct RequestQueue {
/// Map that stores requests IDs with time when they were generated.
ping_map: HashMap<(PublicKey, u64), Instant>,
/// Timeout when requests IDs are considered invalid.
timeout: Duration,
}
To:
pub struct RequestQueue<T: u64 + HardenPingId> {
/// Map that stores requests IDs with time when they were generated.
ping_map: HashMap<(PublicKey, T), Instant>,
/// Timeout when requests IDs are considered invalid.
timeout: Duration,
}
Here T
may be one of these
u64
Or
struct HardenPingId {
sendback_node: PackedNode,
ping_id: u64,
}
- How working
- send periodically hardening getnodes_req to random node in close_list for all of nodes in close_list.
- handle incoming harden getnodes_req by responding with harden getnodes_resp, or handle harden getnodes_resp by checking responded node's PK is in my close_List.
Metadata
Metadata
Assignees
Labels
No labels