Skip to content

Commit 7a2d24d

Browse files
committed
Rename crate
Because tuntap is obviously taken by something rotten, unmaintained and dead.
1 parent 631b192 commit 7a2d24d

File tree

7 files changed

+34
-14
lines changed

7 files changed

+34
-14
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "tuntap"
2+
name = "tun-tap"
33
# Also don't forget to update the version in the html_root_url attribute in src/lib.rs
44
version = "0.1.0"
55
authors = ["Michal 'vorner' Vaner <vorner@vorner.cz>"]

examples/dump_iface.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
//! raw data of the packets that arrive.
55
//!
66
//! You really do want better error handling than all these unwraps.
7-
extern crate tuntap;
7+
extern crate tun_tap;
88

99
use std::process::Command;
1010

11-
use tuntap::{Iface, Mode};
11+
use tun_tap::{Iface, Mode};
1212

1313
/// Run a shell command. Panic if it fails in any way.
1414
fn cmd(cmd: &str, args: &[&str]) {

examples/pingpong.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@
88
//!
99
//! You really do want better error handling than all these unwraps.
1010
11-
extern crate tuntap;
11+
extern crate tun_tap;
1212

1313
use std::process::Command;
1414
use std::sync::Arc;
1515
use std::thread;
1616
use std::time::Duration;
1717

18-
use tuntap::{Iface, Mode};
18+
use tun_tap::{Iface, Mode};
1919

2020
/// The packet data. Note that it is prefixed by 4 bytes ‒ two bytes are flags, another two are
2121
/// protocol. 8, 0 is IPv4, 134, 221 is IPv6. <https://en.wikipedia.org/wiki/EtherType#Examples>.

examples/tokio.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
1111
extern crate futures;
1212
extern crate tokio_core;
13-
extern crate tuntap;
13+
extern crate tun_tap;
1414

1515
use std::process::Command;
1616
use std::time::Duration;
1717

1818
use futures::{Future, Stream};
1919
use tokio_core::reactor::{Core, Interval};
20-
use tuntap::{Iface, Mode};
21-
use tuntap::async::Async;
20+
use tun_tap::{Iface, Mode};
21+
use tun_tap::async::Async;
2222

2323
/// The packet data. Note that it is prefixed by 4 bytes ‒ two bytes are flags, another two are
2424
/// protocol. 8, 0 is IPv4, 134, 221 is IPv6. <https://en.wikipedia.org/wiki/EtherType#Examples>.

examples/vpn.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
1515
extern crate futures;
1616
extern crate tokio_core;
17-
extern crate tuntap;
17+
extern crate tun_tap;
1818

1919
use std::env;
2020
use std::io::Result;
@@ -24,8 +24,8 @@ use futures::{Future, Stream};
2424
use tokio_core::net::{UdpCodec, UdpSocket};
2525
use tokio_core::reactor::Core;
2626

27-
use tuntap::{Iface, Mode};
28-
use tuntap::async::Async;
27+
use tun_tap::{Iface, Mode};
28+
use tun_tap::async::Async;
2929

3030
struct VecCodec(SocketAddr);
3131

src/async.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,26 @@ impl Async {
6767
/// # Errors
6868
///
6969
/// This fails with an error in case of low-level OS errors (they shouldn't usually happen).
70+
///
71+
/// # Examples
72+
///
73+
/// ```rust,no_run
74+
/// # extern crate futures;
75+
/// # extern crate tokio_core;
76+
/// # extern crate tun_tap;
77+
/// # use futures::Stream;
78+
/// # use tun_tap::*;
79+
/// # use tun_tap::async::*;
80+
/// # use tokio_core::reactor::Core;
81+
/// # fn main() {
82+
/// let iface = Iface::new("mytun%d", Mode::Tun).unwrap();
83+
/// let name = iface.name().to_owned();
84+
/// // Bring the interface up by `ip addr add IP dev $name; ip link set up dev $name`
85+
/// let mut core = Core::new().unwrap();
86+
/// let async = Async::new(iface, &core.handle()).unwrap();
87+
/// let (sink, stream) = async.split();
88+
/// # }
89+
/// ```
7090
pub fn new(iface: Iface, handle: &Handle) -> Result<Self> {
7191
let fd = iface.as_raw_fd();
7292
let mut nonblock: c_int = 1;

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
#![doc(html_root_url = "https://docs.rs/tuntap/0.1.0/tuntap/")]
1+
#![doc(html_root_url = "https://docs.rs/tun-tap/0.1.0/tun-tap/")]
22
#![warn(missing_docs)]
33

44
//! A TUN/TAP bindings for Rust.
55
//!
66
//! This is a basic interface to create userspace virtual network adapter.
77
//!
88
//! For basic usage, create an [`Iface`](struct.Iface.html) object and call the
9-
//! [`send`](struct.Iface.html#method.send) and [`recv`](struct.Iface.hmtl#method.recv) methods.
9+
//! [`send`](struct.Iface.html#method.send) and [`recv`](struct.Iface.html#method.recv) methods.
1010
//!
1111
//! You can also use [`Async`](async/struct.Async.html) if you want to integrate with tokio event
1212
//! loop. This is configurable by a feature (it is on by default).
@@ -85,7 +85,7 @@ impl Iface {
8585
/// # Examples
8686
///
8787
/// ```rust,no_run
88-
/// # use tuntap::*;
88+
/// # use tun_tap::*;
8989
/// let iface = Iface::new("mytun", Mode::Tun).expect("Failed to create a TUN device");
9090
/// let name = iface.name();
9191
/// // Configure the device ‒ set IP address on it, bring it up.

0 commit comments

Comments
 (0)