Documentation ¶
Overview ¶
Package go9p contains contains an interface definition for a 9p2000 server, `Srv`. along with a few functions that will serve the 9p2000 protocol using a `Srv`.
Most people wanting to implement a 9p filesystem should start in the subpackage github.com/knusbaum/go9p/fs, which contains tools for constructing a file system which can be served using the functions in this package.
The subpackage github.com/knusbaum/go9p/proto contains the protocol implementation. It is used by the other packages to send and receive 9p2000 messages. It may be useful to someone who wants to investigate 9p2000 at the protocol level.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Verbose bool
If Verbose is true, incoming and outgoing 9p messages will be printed to stderr.
Functions ¶
func PostSrv ¶ added in v0.19.0
PostSrv serves srv, from a file descriptor named name. The fd is posted and can subsequently be mounted. On Unix, the descriptor is posted under in the current namespace, which is determined by 9fans.net/go/plan9/client Namespace. On Plan9 it is posted in the usual place, /srv.
Types ¶
type Conn ¶ added in v0.19.0
Conn represents an individual connection to a 9p server. In the case of a server listening on a network, there may be many clients connected to a given server at once.
type Srv ¶ added in v0.19.0
type Srv interface { NewConn() Conn Version(Conn, *proto.TRVersion) (proto.FCall, error) Auth(Conn, *proto.TAuth) (proto.FCall, error) Attach(Conn, *proto.TAttach) (proto.FCall, error) Walk(Conn, *proto.TWalk) (proto.FCall, error) Open(Conn, *proto.TOpen) (proto.FCall, error) Create(Conn, *proto.TCreate) (proto.FCall, error) Read(Conn, *proto.TRead) (proto.FCall, error) Write(Conn, *proto.TWrite) (proto.FCall, error) Clunk(Conn, *proto.TClunk) (proto.FCall, error) Remove(Conn, *proto.TRemove) (proto.FCall, error) Stat(Conn, *proto.TStat) (proto.FCall, error) Wstat(Conn, *proto.TWstat) (proto.FCall, error) }
The Srv interface is used to handle 9p2000 messages. Each function handles a specific type of message, and should return a response. If some expected error occurs, for example a TOpen message for a file with the wrong permissions, a proto.TError message should be returned rather than a go error. Returning a go error indicates that something has gone wrong with the server, and when used with Serve and PostSrv, will cause the connection to be terminated or the file descriptor to be closed.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
examples
|
|
utilfs
This is a sample filesystem that serves a couple "utilities" There's /time, which when read, will return a human-readable string of the current time.
|
This is a sample filesystem that serves a couple "utilities" There's /time, which when read, will return a human-readable string of the current time. |
Package fs is an package that implements a hierarchical filesystem as a struct, FS.
|
Package fs is an package that implements a hierarchical filesystem as a struct, FS. |
Package proto implements the 9p2000 protocol messages and the code required to marshal the messages.
|
Package proto implements the 9p2000 protocol messages and the code required to marshal the messages. |