libs

package module
v0.1.6-final Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: MIT Imports: 0 Imported by: 0

README

Libs

This is a collection of libraries used to create Altid services, servers, and clients, in a canonical way.

Overview

GoDoc Go Report Card License

How To Get

If you have a working Go toolchain, simply issue the following

go get -u github.com/altid/libs

Build Status

  • Auth passing badge
  • Fs passing badge
  • Markup passing badge
  • Html passing badge
  • Config passing badge

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") } // [...] }
fs
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.

Jump to

Keyboard shortcuts

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