Skip to content

Do not reexport netlink-packet-wireguard - #5

Merged
cathay4t merged 1 commit into
rust-netlink:mainfrom
cathay4t:main
May 13, 2026
Merged

Do not reexport netlink-packet-wireguard#5
cathay4t merged 1 commit into
rust-netlink:mainfrom
cathay4t:main

Conversation

@cathay4t

Copy link
Copy Markdown
Member

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.

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>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

critical

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,
};

@cathay4t
cathay4t merged commit 6484172 into rust-netlink:main May 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant