{"id":18163920,"url":"https://github.com/terassyi/rscni","last_synced_at":"2025-10-05T17:14:09.242Z","repository":{"id":216913503,"uuid":"742735598","full_name":"terassyi/rscni","owner":"terassyi","description":"CNI plugin library in Rust","archived":false,"fork":false,"pushed_at":"2024-04-09T10:33:04.000Z","size":56,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-21T00:12:20.935Z","etag":null,"topics":["cni-plugin","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/terassyi.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":"2024-01-13T07:53:27.000Z","updated_at":"2024-08-23T08:58:18.000Z","dependencies_parsed_at":"2024-01-16T17:32:49.711Z","dependency_job_id":"09ae88a6-437e-4063-a1f2-9d517bb71ce2","html_url":"https://github.com/terassyi/rscni","commit_stats":null,"previous_names":["terassyi/rscni"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/terassyi/rscni","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terassyi%2Frscni","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terassyi%2Frscni/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terassyi%2Frscni/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terassyi%2Frscni/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terassyi","download_url":"https://codeload.github.com/terassyi/rscni/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terassyi%2Frscni/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278486308,"owners_count":25994945,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cni-plugin","rust"],"created_at":"2024-11-02T11:06:33.223Z","updated_at":"2025-10-05T17:14:09.205Z","avatar_url":"https://github.com/terassyi.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RsCNI\n\nRsCNI is a CNI plugin library for Rust.\nThis is based on [containernetworking/cni](https://github.com/containernetworking/cni).\n\n![GitHub release](https://img.shields.io/github/release/terassyi/rscni.svg?maxAge=60)\n[![crate-name at crates.io](https://img.shields.io/crates/v/rscni.svg)](https://crates.io/crates/rscni)\n[![crate-name at docs.rs](https://docs.rs/rscni/badge.svg)](https://docs.rs/rscni)\n![CI](https://github.com/terassyi/rscni/workflows/CI/badge.svg)\n\n\u003e [!WARNING]\n\u003e RsCNI is under experimental.\n\n## Use\n\nRsCNI has a similar APIs to [containernetworking/cni/pkg/skel](https://pkg.go.dev/github.com/containernetworking/cni/pkg/skel).\n\nThe entrypoint structure is `Plugin`.\nIt accepts callback functions defined as `CmdFn` to represent CNI Add, Del and Check commands.\n\n```rust\npub struct Plugin {\n    add: CmdFn,\n    del: CmdFn,\n    check: CmdFn,\n    version_info: PluginInfo,\n    about: String,\n    dispatcher: Dispatcher,\n}\n```\n\n`CmdFn` is the type for CNI commands.\nIt is the function type that accepts `Args` that is CNI arguments and return `CNIResult` or `Error`.\nAs we implement some functions satisfy this type, we can build our own CNI plugin.\n\n```rust\npub type CmdFn = fn(args: Args) -\u003e Result\u003cCNIResult, Error\u003e;\n```\n\nFor async version, we have to implement the following type.\n\n\u003e [!NOTE]\n\u003e To use async version of rscni, please enable the `async` feature in your Cargo.toml.\n\n```rust\npub type CmdFn = fn(Args) -\u003e Pin\u003cBox\u003cdyn Future\u003cOutput = Result\u003cCNIResult, Error\u003e\u003e\u003e\u003e;\n```\n\nTo run `Plugin`, we can call `run()` method like following.\n\n```rust\nfn main() {\n    let version_info = PluginInfo::default();\n    let mut dispatcher = Plugin::new(add, del, check, version_info, ABOUT_MSG);\n\n    dispatcher.run().expect(\"Failed to complete the CNI call\");\n}\n```\n\nFor details, please see [examples/rscni-debug](./examples/README.md).\n\n### Example project\n\n- [rscni-debug](./examples/rscni-debug/src/main.rs)\n- [async-rscni-debug](./examples/async-rscni-debug/src/main.rs)\n\n\n## License\nRsCNI is licensed under the Apache License, Version 2.0. See [LICENSE](./LICENSE) for the full license text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterassyi%2Frscni","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterassyi%2Frscni","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterassyi%2Frscni/lists"}