rcli

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2013 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const ARG_URL_KEY = "q"

Use this key to encode an RPC call into an URL, eg. domain.tld/path/to/method?q=get_user&q=gordon

Variables

View Source
var CLIENT_SOCKET io.Writer = nil
View Source
var DEBUG_FLAG bool = false

Note: the globals are here to avoid import cycle FIXME: Handle debug levels mode?

Functions

func Call

func Call(proto, addr string, args ...string) (*net.TCPConn, error)

Connect to a remote endpoint using protocol `proto` and address `addr`, issue a single call, and return the result. `proto` may be "tcp", "unix", etc. See the `net` package for available protocols.

func ListenAndServe

func ListenAndServe(proto, addr string, service Service) error

Listen on `addr`, using protocol `proto`, for incoming rcli calls, and pass them to `service`.

func ListenAndServeHTTP

func ListenAndServeHTTP(addr string, service Service) error

func LocalCall

func LocalCall(service Service, stdin io.ReadCloser, stdout io.Writer, args ...string) error

func Serve

func Serve(conn io.ReadWriter, service Service) error

Parse an rcli call on a new connection, and pass it to `service` if it is valid.

func Subcmd

func Subcmd(output io.Writer, name, signature, description string) *flag.FlagSet

func URLToCall

func URLToCall(u *url.URL) (method string, args []string)

Types

type AutoFlush

type AutoFlush struct {
	http.ResponseWriter
}

func (*AutoFlush) Write

func (w *AutoFlush) Write(data []byte) (int, error)

type Cmd

type Cmd func(io.ReadCloser, io.Writer, ...string) error

type CmdMethod

type CmdMethod func(Service, io.ReadCloser, io.Writer, ...string) error

type Service

type Service interface {
	Name() string
	Help() string
}

Jump to

Keyboard shortcuts

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