ntop / n2n

Peer-to-peer VPN
GNU General Public License v3.0
6.28k stars 943 forks source link

Keep peers state on edge nodes #96

Open emanuele-f opened 5 years ago

emanuele-f commented 5 years ago

Maybe we can avoid sending duplicate information such us the original edge sender (https://github.com/ntop/n2n/blob/dev/n2n_wire.h#L152 which is 19 bytes long) by implementing a mechanism to ask information about another edge node (see https://github.com/meyerd/n2n/commit/ad2d41651006beb180ea35d4e9bd2b98ca7386cf for example) and caching it on the edge nodes. We already have some structures to hold the peers information (https://github.com/ntop/n2n/blob/dev/n2n.h#L219) but an hash table would be more suitable (see https://github.com/meyerd/n2n/commit/a114909d849af3fcdc6bfabcbd6a926da59b95cb for example). Such structure could be passed to the encyption and decryption functions where a specific transop could add specific fields. This would be a transop-independent way of storing and accessing peers state without relying on struct sa of transop_aes for example.

Logan007 commented 5 years ago

A few thoughts:

emanuele-f commented 5 years ago

For that, I would implement a generic n2n_peer_data request which allows the edges to exchange data (a field specifies the data type). The supernode only acts as a relay. The edge nodes can then encrypt and/or sign payload data as they wish.