server

package module
v0.0.1-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2020 License: MIT Imports: 0 Imported by: 0

README

server

Altid server library and 9p client

GoDoc Tests Go Report Card License

Documentation

Overview

Package server is a library used to build Altid servers

go get github.com/altid/server

9pd

Additionally, this contains the canonical server for Altid, 9pd. It can be retrieved with the following

go get github.com/altid/server/cmd/9pd

Directories

Path Synopsis
Package client provides management of clients for a server go get github.com/altid/server/client
Package client provides management of clients for a server go get github.com/altid/server/client
cmd
9pd command
Package command provides methods and functions for creating and parsing Altid control messages go get github.com/altid/server/command
Package command provides methods and functions for creating and parsing Altid control messages go get github.com/altid/server/command
Package files is a layer over a normal directory to synthesize Stat responses, and allow special semantics for Read/Write requests to opened files Adding import ( "os" "path" "github.com/altid/server/files" ) type NormalHandler struct{} func NewNormal() *NormalHandler { return &NormalHandler{} } func (*NormalHandler) Normal(msg *files.Message) (interface{}, error) { fp := path.Join(msg.Service, msg.Buffer, msg.Target) return os.Open(fp) } func (*NormalHandler) Stat(msg *files.Message) (os.FileInfo, error) { fp := path.Join(msg.Service, msg.Buffer, msg.Target) return os.Lstat(fp) } func main() { fh := files.Handle("/path/to/dir") fh.Add("/myfile", NewNormal()) // [...] }
Package files is a layer over a normal directory to synthesize Stat responses, and allow special semantics for Read/Write requests to opened files Adding import ( "os" "path" "github.com/altid/server/files" ) type NormalHandler struct{} func NewNormal() *NormalHandler { return &NormalHandler{} } func (*NormalHandler) Normal(msg *files.Message) (interface{}, error) { fp := path.Join(msg.Service, msg.Buffer, msg.Target) return os.Open(fp) } func (*NormalHandler) Stat(msg *files.Message) (os.FileInfo, error) { fp := path.Join(msg.Service, msg.Buffer, msg.Target) return os.Lstat(fp) } func main() { fh := files.Handle("/path/to/dir") fh.Add("/myfile", NewNormal()) // [...] }
internal
Package mdns is a convenience wrapper over github.com/grandcat/zeroconf for listing Altid services over mdns go get github.com/altid/server/mdns
Package mdns is a convenience wrapper over github.com/grandcat/zeroconf for listing Altid services over mdns go get github.com/altid/server/mdns
Package tabs contains helper functions for managing tabs in Altid services go get github.com/altid/server/tabs example t, _ := tabs.FromFile("/path/to/a/service") t.Remove("tab1") tab := t.Add("tab2") tab.SetState(Active|Alert) fmt.Println("%s\n", tab)
Package tabs contains helper functions for managing tabs in Altid services go get github.com/altid/server/tabs example t, _ := tabs.FromFile("/path/to/a/service") t.Remove("tab1") tab := t.Add("tab2") tab.SetState(Active|Alert) fmt.Println("%s\n", tab)
Package tail mimicks the behaviour of `tail -f` tail watches an events file for writes and sends out matching events, one for each line written.
Package tail mimicks the behaviour of `tail -f` tail watches an events file for writes and sends out matching events, one for each line written.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL