MCPcopy Index your code
hub / github.com/KevinMGranger/nine

github.com/KevinMGranger/nine @0.5.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.5.0 ↗ · + Follow
179 symbols 271 edges 9 files 28 documented · 16%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

nine   Latest Version Rustc Version 1.34.2 ![Build Status]

The 9p protocol as a serde format and message types.

This crate contains structs representing the various types of messages in the 9p2000 protocol (with other versions coming soon), as well as a serializer and deserializer for the wire format for those messages.

There is not an included server implementation or abstraction.

The purpose of this design is to allow for easy extensibility and experimentation with the protocol.

Stability

This library is in its early stages of development, and thus may have large, backwards-incompatible changes that occur. User discretion is adviced.

Usage example

To connect to a 9p server and start version negotiation:

use std::io::prelude::*;
use std::net::TcpStream;
use nine::ser::*;
use nine::de::*;
use nine::p2000::*;

let connection = TcpStream::connect("127.0.0.1").unwrap();
let version = Tversion { tag: NOTAG, msize: u32::max_value(), version: "9p2000".into() };
let serialized_message: Vec<u8> = into_bytes(&version).unwrap();
connection.write_all(&serialized_message).unwrap();

Client Binary

nine can also be used as a simple one-shot 9p client, a-la plan9port's 9p command.

Currently only non-authed explicitly-attached read to a unix socket is implemented.

Examples

# set up a server to listen at /tmp/9ptest, then:
$ nine -a /tmp/9ptest read /foo
bar

Special Thanks

Casey Rodarmor for collaborating on the initial design.

The countless others in the rust community that have answered my questions.

Extension points exported contracts — how you extend this code

MessageTypeId (Interface)
An implementer of MessageTypeId has a u8 ID.
src/common.rs
SimpleClient (Interface)
(no doc) [1 implementers]
src/main.rs

Core symbols most depended-on inside this repo

send_msg
called by 7
src/main.rs
write_str
called by 7
tests/messages.rs
read_msg
called by 6
src/main.rs
seek_fwd
called by 6
src/ser.rs
seek_back
called by 6
src/ser.rs
ser
called by 5
tests/serde.rs
des
called by 5
tests/messages.rs
ser
called by 5
tests/messages.rs

Shape

Method 104
Class 41
Function 28
Enum 4
Interface 2

Languages

Rust100%

Modules by API surface

src/ser.rs55 symbols
src/de.rs43 symbols
src/p2000.rs35 symbols
src/main.rs14 symbols
tests/messages.rs11 symbols
src/common.rs9 symbols
tests/serde.rs8 symbols
tests/util.rs4 symbols

For agents

$ claude mcp add nine \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact