asn

command module
v0.0.0-...-9413c1f Latest Latest
Warning

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

Go to latest
Published: May 15, 2015 License: BSD-3-Clause Imports: 35 Imported by: 0

README

Package asn implements the Apptimist Social Network Protocol described in this RFC.

Fetch asn and its dependencies with GO tool.

go get -u github.com/apptimistco/asn

(See the MacOS section for running asn on that instead of Linux)

This will install these external dependencies. github.com/agl/ed25519 github.com/tgrennan/go-gnureadline golang.org/x/crypto golang.org/x/net gopkg.in/yaml.v1

Note: go-gnureadline requires libreadline-dev; so, on Ubuntu:

sudo apt-get install libreadline-dev

Test the dependencies.

go test -i github.com/apptimistco/asn

Run the package tests.

go test github.com/apptimistco/asn

Run the tests with diagnostics written to test.diag.

go test -tags diag github.com/apptimistco/asn

Build the asn command.

go build github.com/apptimistco/asn

Build asn with diagnostics.

go build -tags diag github.com/apptimistco/asn

Generate keys and hack a config.

asn -new-keys > my-keys.yaml
asn -config test-sf -show-config >my-srv.yaml
echo keys: my-keys.yaml >>my-srv.yaml
editor my-srv.yaml
asn -config test-adm -show-config >my-adm.yaml
echo keys: my-keys.yaml >>my-adm.yaml
editor my-adm.yaml

Run and test.

asn -config my-srv &
asn -config my-adm echo hello world

See this recipe for build and test of Docker containers.

MacOS

To run asn under MacOS, start by installing Go tools.

a. Prebuilt install

  • Download latest https://golang.org/dl/

  • Open and install go1.*.darwin-amd64-osx10.8.pkg

  • Setenv

    export GOROOT=/usr/local/go export GOPATH=${HOME}/go export PATH=$PATH:$GOROOT/bin:$GOPATH/bin

b. Build from source

export GOPATH=$HOME/go
git clone --branch go1.4 https://go.googlesource.com/go
(cd go/src; ./all.bash)

See http://golang.org/s/gogetcmd to download Version Control Tools The Xcode development kit includes Git but you may need Mercurial http://mercurial.selenic.com/downloads or, after installing Macports: https://guide.macports.org/

sudo port install mercurial

Install readline before getting asn.

sudo port install readline

GoDoc

Documentation

Overview

Package "asn" implements the Apptimist Social Networks a server and adminsttration client for the protocol described in: https://github.com/apptimistco/rfc/blob/master/asn.md

Usage: asn [FLAGS] [COMMAND [ARGS...]]

Flags:

  -admin=false: Run COMMAND or CLI in admin mode.
	This is the default action if the configuration doesn't have
	any listerners.
  -config="asn.yaml": Set configuration filename.
	Without this flag asn searches './' and '/etc' for 'asn.yaml'.
  -diag="": If built with the 'diag' tag, this redirects output
	to the named file instead of syslog.
  -log="": If built *without* the 'nolog' tag, this redirects
	output to the named file instead of syslog.
  -new-keys=false: Print new keys and exit.
  -nologin=false: run COMMAND w/o login
  -server="0": Connect to the configured server with the matching name,
	URL or at the given index.
  -show-config=false: Print configuration with redacted keys and exit.
  -show-errors=false: Print ASN protocol error codes and exit.
  -show-help=false: Print this and exit.
  -show-ids=false: Print ASN protocol identifiers and exit.
  -show-sums=false: Print sums of *.go files and exit.

Examples:

  $ asn -config example-sf.yaml &
  $ asn -config example-adm.yaml echo hello world
  $ asn -config example-adm.yaml -server 1 echo hello world
  $ asn -config example-adm.yaml -server sf echo hello world
  $ asn -config example-adm.yaml -server sf			# CLI
  $ asn -config example-adm.yaml -server sf - <<-EOF
	echo hello world
  EOF

Commands:

  approve BLOB...
	Before acknowledgment, the server forwards the matching blobs
	to its owner or subscriber.
  auth [-u USER] AUTH
	Record user's ED255519 authentication key.
  blob <USER|[USER/]NAME> - CONTENT
	Creates named blob.
  cat BLOB...
	Returns the contents of the named blob.
  clone [NAME][@TIME]
	Replicate or update an object repository.
  echo [STRING]...
	Returns space separated ARGS in the Ack data.
  filter FILTER [ARGS... --] [BLOB...]
	Returns STDOUT of FILTER program run with list of blobs as STDIN.
  fetch BLOB...
	Before acknowledgement the server sends all matching blobs.
  gc [-v|--verbose] [-n|--dry-run] [@TIME]
	Before acknowledgement the server purges older or all blobs
	flagged for deletion.
  iam NAME
        Show NAME instead of LOGIN key in list of Who.
	Used by servers in indirect clone request.
  ls [BLOB...]
	Returns list of matching blobs.
  mark [-u USER] [LATITUDE LONGITUDE | 7?PLACE]
	Record user's location.
  newuser <"actual"|"bridge"|"forum"|"place">
	Creates a new user and return keys in acknowledgment.
  objdump BLOB...
	Returns the decoded header of the named blob
  rm BLOB...
	Flag blobs for removal by garbage collector.
  trace [COMMAND [ARG]]
	Return and flush the PDU trace or manipulate its filter.
  users
	List all users.
  vouch USER SIG
	Vouch for or deny USER's identity.
  who
	List logged in user names, if set, or login key.

Where BLOB may be any of the following:

-
'$'<'*' | SUM>[@TIME]
['~'['*' | '.' | USER]][GLOB][@TIME]

Server CONFIG Format:

name: STRING
dir: PATH
lat: FLOAT
lon: FLOAT
listen:
- unix:///PATH.sock
- tcp://:PORT
- ws://[HOST][:PORT]/PATH.ws
keys:
  admin:
    pub:
      encr: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      auth: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  server:
    pub:
      encr: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      auth: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    sec:
      encr: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      auth: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  nonce: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Admin CONFIG Format:

name: STRING
dir: PATH
lat: FLOAT
lon: FLOAT
keys:
  admin:
    pub:
      encr: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      auth: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    sec:
      encr: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      auth: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  server:
    pub:
      encr: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
      auth: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  nonce: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
server:
- name: local
  url: unix:///PATH.sock
- name: sf
  url: ws://HOST[:PORT]/PATH.ws
  lat: 37.774929
  lon: -122.419415
- name: la
  url: ws://HOST[:PORT]/PATH.ws
  lat: 34.052234
  lon: -118.243684

Directories

Path Synopsis
Package debug provides log and trace facilities as enabled or disabled with these build tags: fixme, diag, nolog, notrace.
Package debug provides log and trace facilities as enabled or disabled with these build tags: fixme, diag, nolog, notrace.
accumulator
Package accumulator provides an integer wrapper with a pointer receiver method to sum results of Read, ReadFrom, Write and WriteTo signatures.
Package accumulator provides an integer wrapper with a pointer receiver method to sum results of Read, ReadFrom, Write and WriteTo signatures.
file
Package file provides a wrapper to os.File that, when built with both "diag" and "file" tags (e.g.
Package file provides a wrapper to os.File that, when built with both "diag" and "file" tags (e.g.
mutex
Package mutex provides a wrapper interface to sync.Mutex that, when built with both "diag" and "mutex" tags (e.g.
Package mutex provides a wrapper interface to sync.Mutex that, when built with both "diag" and "mutex" tags (e.g.

Jump to

Keyboard shortcuts

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