Do not reexport netlink-packet-wireguard - #5
Conversation
Since we already provides `WireguardParsed` interface, if user still want to use the old way, they should use both this crate and `netlink-packet-wireguard`. Signed-off-by: Gris Ge <cnfourt@gmail.com>
There was a problem hiding this comment.
Code Review
This pull request removes the public re-exports of several netlink-packet-wireguard data types from the crate root in src/lib.rs. The review feedback points out that this change will break internal compilation for modules that import these types from the crate root and will force external users to add netlink-packet-wireguard as a direct dependency. A suggestion was provided to use internal re-exports to maintain functionality while potentially restricting the public API.
I am having trouble creating individual review comments. Click here to see my feedback.
src/lib.rs (77-83)
Removing these re-exports will break the compilation of the crate. Internal modules such as src/parsed.rs and src/peer_parsed.rs currently import these types from the crate root (e.g., use crate::{WireguardAttribute, ...}).
Furthermore, several of these types (such as WireguardCmd and WireguardMessage) are used in the public API signatures of WireguardParsed and WireguardPeerParsed. If they are not re-exported, users of this library will be forced to add netlink-packet-wireguard as a direct dependency to interact with these methods.
If the intention is to remove them from the public API while keeping the crate functional, you should use pub(crate) use and update the public signatures to avoid "private type in public interface" errors, or update all internal references to use the netlink_packet_wireguard crate directly.
// Internal re-export of netlink-packet-wireguard data types.
pub(crate) use netlink_packet_wireguard::{
WireguardAddressFamily, WireguardAllowedIp, WireguardAllowedIpAttr,
WireguardAttribute, WireguardCmd, WireguardMessage, WireguardPeer,
WireguardPeerAttribute, WireguardTimeSpec,
};
Since we already provides
WireguardParsedinterface, if user stillwant to use the old way, they should use both this crate and
netlink-packet-wireguard.