{"id":16163815,"url":"https://github.com/edigaryev/vmnet","last_synced_at":"2026-01-18T05:59:00.561Z","repository":{"id":62444773,"uuid":"499215780","full_name":"edigaryev/vmnet","owner":"edigaryev","description":"Apple's vmnet.framework bindings for Rust","archived":false,"fork":false,"pushed_at":"2025-01-07T21:31:20.000Z","size":49,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-28T04:47:20.464Z","etag":null,"topics":["networking","rust","vmnet"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edigaryev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2022-06-02T16:46:48.000Z","updated_at":"2025-01-07T21:31:24.000Z","dependencies_parsed_at":"2024-04-17T13:37:57.392Z","dependency_job_id":"02bbdc09-5a2b-4157-8b44-96f7e7ba4e8d","html_url":"https://github.com/edigaryev/vmnet","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"a54f0d2327af4e742a7bec97acd56c52c3d3b592"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edigaryev%2Fvmnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edigaryev%2Fvmnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edigaryev%2Fvmnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edigaryev%2Fvmnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edigaryev","download_url":"https://codeload.github.com/edigaryev/vmnet/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243955020,"owners_count":20374368,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["networking","rust","vmnet"],"created_at":"2024-10-10T02:44:31.590Z","updated_at":"2026-01-18T05:59:00.552Z","avatar_url":"https://github.com/edigaryev.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# vmnet\n\n[![Docs.rs](https://img.shields.io/docsrs/vmnet)](https://docs.rs/vmnet)\n\nApple's [`vmnet.framework`](https://developer.apple.com/documentation/vmnet) bindings for Rust.\n\n## Installation\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nvmnet = \"0\"\n```\n\n## Usage\n\nEnsure that your software either has an `com.apple.vm.networking` entitlement or is running with elevated privileges.\n\nStart a NAT interface and receive some packets destined to it:\n\n```rust\nlet shared_mode = Shared {\n    subnet_options: None,\n    ..Default::default()\n};\n\nlet mut iface = Interface::new(Mode::Shared(shared_mode), Options::default()).unwrap();\n\nlet (tx, rx) = sync::mpsc::sync_channel(0);\n\niface.set_event_callback(Events::PACKETS_AVAILABLE, move |events, params| {\n    if let Some(Parameter::EstimatedPacketsAvailable(pkts)) = params.get(ParameterKind::EstimatedPacketsAvailable) {\n        tx.send(pkts);\n    }\n}).unwrap();\n\nlet pkts = rx.recv().unwrap();\nprintln!(\"receiving {} packets...\", pkts);\nfor _ in 0..pkts {\n    let mut buf: [u8; 1514] = [0; 1514];\n    println!(\"{:?}\", iface.read(\u0026mut buf));\n}\n\ndrop(rx);\niface.finalize().unwrap();\n```\n\n## Quirks\n\n* due to Apple's usage of [blocks](https://en.wikipedia.org/wiki/Blocks_(C_language_extension)) as a way to retrieve API call results, some methods like `set_event_callback()` require the provided closure to have a `'static` lifetime\n  * this manifests itself in not being able to use `Interface` from such closure\n  * however, this can be easily worked around by using [interior mutability pattern](https://doc.rust-lang.org/book/ch15-05-interior-mutability.html) or simply by using the callback as a signal carrier\n* due to `API_AVAILABLE` macro not being supported it is assumed that this package is running on macOS 15.0 or newer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedigaryev%2Fvmnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedigaryev%2Fvmnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedigaryev%2Fvmnet/lists"}