djdv / go-filesystem-utils

ISC License
10 stars 2 forks source link

9P host and guest support #39

Open djdv opened 1 year ago

djdv commented 1 year ago

Closes: https://github.com/djdv/go-filesystem-utils/issues/13 Initial draft for 9P host and guest implementations. Seems to work for read-only stuff. Still need to do tests with writable systems since some required operations are probably missing implementations at the moment.

(I had this working a few months ago but forgot to publish the draft. Oops.)

Example server/host invocation: fs mount 9p ipfs $multiaddr would host the IPFS API on $multiaddr which a client could then attach to.

Example guest/client invocation: fs mount fuse 9p -9p-server $multiaddr $mountpoint would attach to $multiaddr and mount it (via FUSE) at $mountpoint

The invocation names and flags may change. Suggestions welcomed. I'm not sure if 9p-server, 9p-client would be better than keeping them both as just 9p. We only support 9P2000.L at the moment, but this may change in the far future. If/when it does we'd probably support a -protocl-version flag to select specific ones, or they could be broken out into a unique command namespace. E.g. fs mount 9p2000l ipfs ... but this may be too verbose and not sensible to implement compared to a singular 9p with flags.