docker-archive / go-p9p

A modern, performant 9P library for Go.
Apache License 2.0
206 stars 50 forks source link

Please include an example? #25

Open dlorenc opened 8 years ago

dlorenc commented 8 years ago

Hey,

I'm trying to figure out how to use this library, and I'm having some trouble. I've gotten 9ps to run, but I can't get anything to connect to it. If I run 9pr (or try to mount from a VM), I get something like this:

./9ps
connected 127.0.0.1:59200
dialing :5640 for &{{0xc8f1269b90}}
connected 127.0.0.1:59201
dialing :5640 for &{{0xc8f1269c70}}
connected 127.0.0.1:59202
dialing :5640 for &{{0xc8f1889340}}
connected 127.0.0.1:59203
dialing :5640 for &{{0xc8f1889420}}
connected 127.0.0.1:59204
error accepting: accept tcp [::]:5640: accept4: too many open files
porterjamesj commented 8 years ago

@dlorenc I have not gotten 9ps to work either. As a method for learning about 9p, I am writing a small server to proxy access to github gists using this library, which you might be interested in looking at as an example: https://github.com/porterjamesj/gist9p

It's still very much a work in progress, nothing is stable, and I make no guarentee that I'm doing anything the correct way, but I have gotten a few ls's to work :) It at least might be helpful to read just to see how its wired together, I've tried it with a number of clients, including 9pr from this package and they at all get at least somewhere.

dlorenc commented 8 years ago

@porterjamesj thanks! I'll take a look. @stevvooe any idea why 9ps doesn't seem to work?

stevvooe commented 8 years ago

@porterjamesj @dlorenc 9ps is just a simple pass-through to test the sessionization a forwarding. Please see https://github.com/docker/go-p9p/blob/master/cmd/9ps/main.go#L67. You can run it with another tool, called ufs, to test it out. 9pr should work with either 9ps or ufs directly.

For 9ps to work alone, we'll need to implement the 9p <-> fs translation. Its not wildly hard, but I found it easier to have a proxy to verify the implementation. If someone wants to provide a contribution to make this more usable, that would be great. Such an addition might require an object layer to make it slightly easier.

aaron-prindle commented 7 years ago

@stevvooe could you clarify what ufs is and how I might obtain it? I have searched for the tool but have been unable to find it. Thanks.

stevvooe commented 7 years ago

@aaron-prindle You can just use any existing 9p server.

ufs was apart of the original go9p bindings, found in https://code.google.com/archive/p/go9p/source/default/source.

If someone wants to submit a PR that makes 9ps just serve up the local filesystem, that might be a lot easier to try it out. I just fowarded to ufs to make testing the protocol stack easier.

abitrolly commented 4 years ago

Documenting what 9ps, 9ps and ufs do at their current form at https://godoc.org/github.com/docker/go-p9p/cmd/9ps would already be an advantage.

b1b8898e7cb788d8274eb8d4c9cca1fe380f505a adds something to 9ps.

abitrolly commented 4 years ago

I could list directory and file contents served by 9ps.

go get -v github.com/docker/go-p9p/cmd/9ps
~/go/bin/9ps -root . -addr 192.168.100.20:3333

Attempt to create a file gives this error.

$ touch xxx
<- Tstat tag 0d fid 0d
-> Rstat tag 0d  stat '.' '' '' 'none' q (0000000003547781x 3423971455d d) m 2147484141o at 1575382002 mt 1575382001 l 4096 t 0 d 0
<- Twalk tag 0d fid 0 newfid 1 nwname 1 0:xxx 
-> Rwalk tag 0d nwqid 0d 
<- Twalk tag 0d fid 0 newfid 1 nwname 0 
-> Rerror tag 0d ename duplicate fid

Looks like a problem with my client, who should issue open after the walk failed.