DefGuard / wireguard-rs

Rust library providing unified WireGuard interface to native/kernel and userspace implementations
https://github.com/defguard/defguard/
Other
124 stars 11 forks source link

How work write and delete peer ? #12

Closed Ange-Cesari closed 9 months ago

Ange-Cesari commented 9 months ago

Hi,

I need to rewrite peers without restarting the interface (i must not disconnect other peer to add or delete one from the interface)

Is it possible with the write_peer and delete_peer ?

If so, "updating" a peer sequence should Just be :

write_peer delete_peer write_peer

Is that correct ?

Best, Ange

teon commented 9 months ago

@wojcik91 is doing some cleanup and rewrite - @wojcik91 could you comment regarding release we plan tomorrow/Monday?

Ange-Cesari commented 9 months ago

Hello @wojcik91

I see that you've done some changes on the code.

Could you please give some informations, is the release complete ?

Thanks, Ange

wojcik91 commented 9 months ago

Hi @Ange-Cesari

We've just completed the refactor and made the first actual release (v0.2.0). I've tried to clean up the existing code as much as possible and add a common Trait which enables us to have a consistent management API between different platforms/implementations. This should make it easier to add more integrations in a sort of "plugin" approach. Personally I hope to have some free time to add a Mikrotik integration for my own homelab use :)

Going back to the original question - current API exposes two methods related to managing peers:

configure_peer can be used to both add a completely new peer or configure an existing one. You can think of it as an UPSERT query in SQL. So to reconfigure a peer you should be able to just use configure_peer with no additional steps necessary.