https://github.com/canndrew/netsim
Rust library for network simulation
+--------+
| #include <iostream> | |
| using namespace std; | |
| class Rectangle { | |
| public: | |
| int width; | |
| int height; | |
| Rectangle(int width, int height) { | |
| this->width = width; |
https://github.com/canndrew/netsim
Rust library for network simulation
+--------+
| <domain type='kvm'> | |
| <name>reactos</name> | |
| <uuid>3ea9f890-f2d9-4c25-b6c7-fb14e254f14c</uuid> | |
| <memory unit='KiB'>2097152</memory> | |
| <currentMemory unit='KiB'>2097152</currentMemory> | |
| <vcpu placement='static'>2</vcpu> | |
| <os> | |
| <type arch='x86_64' machine='pc-i440fx-2.11'>hvm</type> | |
| <boot dev='hd'/> | |
| </os> |
| import socket | |
| sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
| w_buf = sock.getsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF) | |
| r_buf = sock.getsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF) | |
| print(w_buf, r_buf) |
| thread 'Crust-Event-Loop' panicked at 'called `Option::unwrap()` on a `None` value', src/libcore/option.rs:345:21 | |
| note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. | |
| stack backtrace: | |
| 0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace | |
| at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39 | |
| 1: std::sys_common::backtrace::_print | |
| at src/libstd/sys_common/backtrace.rs:70 |
| thread 'Crust-Event-Loop' panicked at 'specified instant was later than self', src/libstd/sys/unix/time.rs:292:17 | |
| note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. | |
| stack backtrace: | |
| 0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace | |
| at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39 | |
| 1: std::sys_common::backtrace::_print | |
| at src/libstd/sys_common/backtrace.rs:70 | |
| 2: std::panicking::default_hook::{{closure}} | |
| at src/libstd/sys_common/backtrace.rs:58 | |
| at src/libstd/panicking.rs:200 |
| use unwrap::unwrap; | |
| use std::sync::Arc; | |
| use std::cell::RefCell; | |
| use std::rc::Rc; | |
| use tokio::runtime::current_thread::{self, Runtime}; | |
| use futures::{future, Future, Stream}; | |
| struct TestContext { | |
| /// Hold connections so that streams wouldn't be closed prematurely | |
| connections: Vec<quinn::Connection>, |
I hereby claim:
To claim this, I am signing this object:
| import socket | |
| from typing import List | |
| def main(): | |
| socks = udp_sockets(1021) | |
| print(len(socks)) | |
| def udp_sockets(n: int) -> List[socket.socket]: |
| #[cfg(target_os = "linux")] | |
| #[test] | |
| fn keep_alive() { | |
| let mut evloop = Core::new().unwrap(); | |
| let network = Network::new(&evloop.handle()); | |
| let network_handle = network.handle(); | |
| let (server_addr_tx, server_addr_rx) = oneshot::channel(); | |
| let (plug_client, mut plug_server) = IpPlug::new_pair(); |