Skip to content

Commit 42e9437

Browse files
authored
chore: Linux & FreeBSD cleanup (#96)
* update flake * remove unused import * adjust docs formatting
1 parent 60bcc67 commit 42e9437

File tree

4 files changed

+21
-16
lines changed

4 files changed

+21
-16
lines changed

flake.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
};
2626
rustToolchain = pkgs.rust-bin.stable.latest.default.override {
2727
extensions = ["rust-analyzer" "rust-src" "rustfmt" "clippy"];
28+
targets = ["x86_64-unknown-linux-gnu" "armv7-unknown-linux-gnueabihf" "aarch64-unknown-linux-gnu" "x86_64-unknown-freebsd"];
2829
};
2930
# define shared build inputs
3031
nativeBuildInputs = with pkgs; [rustToolchain pkg-config];

src/wgapi_freebsd.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,21 @@ impl WireguardInterfaceApi for WGApi<Kernel> {
3333
/// Add peer addresses to network routing table.
3434
///
3535
/// For every allowed IP, it runs:
36-
/// - `route -q -n add <inet> allowed_ip -interface if_name`
37-
/// `ifname` - interface name while creating api
38-
/// `allowed_ip`- one of [Peer](crate::Peer) allowed ip
36+
/// `route -q -n add <inet> allowed_ip -interface if_name`
37+
///
38+
/// Where:
39+
/// - `ifname` - interface name while creating api
40+
/// - `allowed_ip`- one of [Peer](crate::Peer) allowed ip
41+
///
3942
/// For `0.0.0.0/0` or `::/0` allowed IP, it adds default routing and skips other using:
40-
/// - `route -q -n add <inet> 0.0.0.0/1 -interface if_name`.
41-
/// - `route -q -n add <inet> 128.0.0.0/1 -interface if_name`.
42-
/// - `route -q -n add <inet> <endpoint> -gateway <gateway>`
43-
/// `<endpoint>` - Add routing for every unique Peer endpoint.
44-
/// `<gateway>`- Gateway extracted using `netstat -nr -f <inet>`.
43+
/// - `route -q -n add <inet> 0.0.0.0/1 -interface if_name`.
44+
/// - `route -q -n add <inet> 128.0.0.0/1 -interface if_name`.
45+
/// - `route -q -n add <inet> <endpoint> -gateway <gateway>`
46+
///
47+
/// Where:
48+
/// - `<endpoint>` - Add routing for every unique Peer endpoint.
49+
/// - `<gateway>`- Gateway extracted using `netstat -nr -f <inet>`.
50+
///
4551
/// ## Note:
4652
/// Based on ip type `<inet>` will be equal to `-inet` or `-inet6`
4753
fn configure_peer_routing(&self, peers: &[Peer]) -> Result<(), WireguardInterfaceError> {

src/wgapi_userspace.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ use std::{
77
time::Duration,
88
};
99

10-
#[cfg(feature = "check_dependencies")]
11-
use crate::dependencies::check_external_dependencies;
1210
#[cfg(target_os = "linux")]
1311
use crate::netlink;
1412
#[cfg(any(target_os = "freebsd", target_os = "linux", target_os = "netbsd"))]

0 commit comments

Comments
 (0)