Documentation ¶
Overview ¶
Package libs is a collection of Go libraries for building Altid filesystems
Refer to altid.github.io for an overview
Directories ¶
Path | Synopsis |
---|---|
Package auth - common auth functions for services, servers, and clients in Altid.
|
Package auth - common auth functions for services, servers, and clients in Altid. |
Package config allows Altid services to interact withe the ndb-formatted configuration files used by Altid go get github.com/altid/libs/config The ndb format is described in http://man.cat-v.org/plan_9/6/ndb Usage A service can marshall values to a struct through Marshall, as long as the entries follow these rules: - Nested structs will be ignored - Type must be bool, int, string, or one of Auth, Log, or ListenAddress - structs must have default values set Example: // package mypackage import ( "flag" "log" "os" "os/user" "github.com/altid/libs/config" "github.com/altid/libs/config/types" ) var conf = flag.Bool("conf", false, "Create configuration file") func main() { flag.Parse() u, _ := user.Current mytype := struct { // Struct tags are used by Create to interactively fill in any missing data Name string `Enter a name to use on the service` UseTLS bool `Use TLS? (true|false)` Port int Auth types.Auth `Enter the authentication method you would like to use: password|factotum|none` Logdir types.Logdir ListenAddress config.ListenAddress }{u.Name, false, 564, "none", "", ""} if flag.Lookup("conf") != nil { if e := config.Marshall(&mytype, "myservice", false); e != nil { log.Fatal(e) } os.Exit(0) } // Your error message should indicate that the user re-runs with -conf to create any missing entries if e := config.Marshall(&mytype, "myservice", false); e != nil { log.Fatal("unable to create config: %v\nRun program with -conf to create missing entries") } // [...] }
|
Package config allows Altid services to interact withe the ndb-formatted configuration files used by Altid go get github.com/altid/libs/config The ndb format is described in http://man.cat-v.org/plan_9/6/ndb Usage A service can marshall values to a struct through Marshall, as long as the entries follow these rules: - Nested structs will be ignored - Type must be bool, int, string, or one of Auth, Log, or ListenAddress - structs must have default values set Example: // package mypackage import ( "flag" "log" "os" "os/user" "github.com/altid/libs/config" "github.com/altid/libs/config/types" ) var conf = flag.Bool("conf", false, "Create configuration file") func main() { flag.Parse() u, _ := user.Current mytype := struct { // Struct tags are used by Create to interactively fill in any missing data Name string `Enter a name to use on the service` UseTLS bool `Use TLS? (true|false)` Port int Auth types.Auth `Enter the authentication method you would like to use: password|factotum|none` Logdir types.Logdir ListenAddress config.ListenAddress }{u.Name, false, 564, "none", "", ""} if flag.Lookup("conf") != nil { if e := config.Marshall(&mytype, "myservice", false); e != nil { log.Fatal(e) } os.Exit(0) } // Your error message should indicate that the user re-runs with -conf to create any missing entries if e := config.Marshall(&mytype, "myservice", false); e != nil { log.Fatal("unable to create config: %v\nRun program with -conf to create missing entries") } // [...] } |
Package fs is a library which allows you to write well constructed Altid services Overview fs aims to present a way to write canonical services, which behave correctly in all instances.
|
Package fs is a library which allows you to write well constructed Altid services Overview fs aims to present a way to write canonical services, which behave correctly in all instances. |
Package html helper library for parsing HTML for Altid markup
|
Package html helper library for parsing HTML for Altid markup |
Package markup implements an API for escaping markup elements in raw text input.
|
Package markup implements an API for escaping markup elements in raw text input. |
Click to show internal directories.
Click to hide internal directories.