ghvstcode / rust-tcp Goto Github PK
View Code? Open in Web Editor NEWImplementing TCP In Rust
License: Creative Commons Attribution 4.0 International
Implementing TCP In Rust
License: Creative Commons Attribution 4.0 International
#!/bin/bash
cargo b --release
sudo setcap cap_net_admin=eip ./target/release/tcp
./target/release/tcp &
pid=$1
sudo ip addr add 192.168.0.1/24 dev tun0
trap "kill $pid" INT TERM
wait $pid
fix pid=$1 to pid=$1, so the pid var is correcly assigned?
#!/bin/bash
cargo b --release
sudo setcap cap_net_admin=eip ./target/release/tcp
./target/release/tcp &
pid=$!
sudo ip addr add 192.168.0.1/24 dev tun0
trap "kill $pid" INT TERM
wait $pid
If the reader were to follow the instructions in Chapter 1 and then decide to no longer follow the book, what actions (if any) would be required by the reader to restore their system to the pre-book state?
If actions were required, consider listing them or adding a teardown script.
If no actions are required, consider highlighting that point and explaining why no further actions would be required.
Two corrections are needed in chapter 1, in order to improve clarity and usability of the snippets presented.
Based on the comment in the code snippet and on the output of the command ip addr
presented, the following line of rust given as an exemple :
let nic = tun_tap::Iface::new("tune", tun_tap::Mode::Tun)?;
Needs to be :
let nic = tun_tap::Iface::new("tun0", tun_tap::Mode::Tun)?;
The following command is used : ping - I tun0 192.168.0.2
. However, based on the man page of ping
, it should be : ping -I tun0 192.168.0.2
.
Consider adding a section to README.md that outlines the expected level of background knowledge on various topics for best results. E.g:
"This book assumes you have an intermediate understanding of Rust, and are at least passingly familiar with computer networking. The code samples assume you are running Linux, and will not work on other operating systems without modification. It is assumed you are using Rust (XX) or newer - backwards compatibility is not guaranteed."
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.