daemon

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2019 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAddr = Addr("127.0.0.1:1271")

DefaultAddr is the default daemon listening address.

Variables

This section is empty.

Functions

func IsNotRunning

func IsNotRunning(err error) bool

IsNotRunning returns true if err indicates that the daemon is not running.

Types

type Addr

type Addr string

Addr is the daemon network address. The zero value implies DefaultAddr.

func (Addr) Kill

func (d Addr) Kill() error

Kill terminates the daemon.

func (Addr) Send

func (d Addr) Send(msg interface{}) (interface{}, error)

Send sends a message to the daemon and returns the response. The message and response data types must be gob-registered.

func (*Addr) Serve

func (d *Addr) Serve() (<-chan *Request, error)

Serve returns the channel on which the daemon will send incoming messages. Address is updated to reflect the actual listening socket address.

func (*Addr) Start

func (d *Addr) Start(fn StartFunc) error

Start starts the daemon process. Address is updated to reflect the actual listening socket address.

type Request

type Request struct {
	net.Conn
	Msg interface{}
	Rch chan<- interface{}
}

Request contains the client connection, the received message, and the response channel. The handler must either send a response via Rch or close it without sending anything, which will close the network connection.

type StartFunc

type StartFunc func(c *exec.Cmd) error

StartFunc should call c.Start() to start the daemon process after making any adjustments to the command parameters.

Jump to

Keyboard shortcuts

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