#tcp #stack #perfect #layer #networking #dns #presumes

bin+lib mtcp

假设完美网络层的 TCP/IP 堆栈

1 个不稳定版本

使用旧的 Rust 2015

0.1.0 2017年1月6日

15#perfect 中排名

GPL-3.0 许可协议

160KB
3.5K SLoC

mtcp

mtcp 是一个假设完美网络层的 Rust TCP/IP 堆栈。

用法

cargo build --release

以下是一个示例,它监听 tun1 接口,通过 127.0.0.1:3148 转发流量,并使用远程 DNS 解析域名。

sudo ip tuntap add dev tun1 mode tap user $YOUR_USER_ID
sudo ip a a dev tun1 10.0.0.1/24"
sudo route add default gw 10.0.0.2 metric 6

cargo run --release -- '127.0.0.1:3148' --dns 8.8.8.8 --tun tun1

sudo ip route del default via 10.0.0.2

注意

  • 仅支持 IPv4
  • 使用本地线程

许可证 GPLv3

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

依赖关系

~6MB
~110K SLoC