Skip to content

Latest commit

 

History

History
36 lines (30 loc) · 713 Bytes

README.md

File metadata and controls

36 lines (30 loc) · 713 Bytes

ya9p

Go Reference

This package is experimental.

Package ya9p provides 9P server implementations. This package provides only the minimum functionality required to serve 9P. In addition, it can serve filesystems defined in fs.FS.

example

Let's serve the local file system with 9P.

package main

import (
	"os"
	"net"
	"log"

	"github.com/rmatsuoka/ya9p"
)

func main() {
	listener, err := net.Listen("tcp", "localhost:8000")
	if err != nil {
		log.Fatal(err)
	}
	for {
		conn, err := listener.Accept()
		if err != nil {
			log.Print(err)
		}
		go ya9p.ServeFS(conn, os.DirFS("/"))
	}
}