canrpc

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: BSD-3-Clause Imports: 5 Imported by: 1

Documentation

Overview

Package canrpc implements net/rpc client and server objects. It is possible to register a can.Device with a server, and to speak to the server via can.Device on the client side.

The package automatically registers a driver with the can package drivers list under the name "rpc". If, for example, a server is running on host 192.168.1.2, port 6000, the address provided to to the can.Open call would be written as:

rpc:192.168.1.2:6000

An optional name can be appended, prefixed by a slash, if the server is exporting multiple CAN devices:

rpc:192.168.1.2:6000/device2

The name must, of course, match the one configured in the server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDevice

func NewDevice(c Caller, name string) can.Device

func Register

func Register(r Registrar, dev can.Device, name string) error

Register a can.Device with an RPC server.

Types

type Caller

type Caller interface {
	Call(funcName string, arg, reply interface{}) error
}

Satisfied by any object that has a Call method as described, like *rpc.Client.

type Registrar

type Registrar interface {
	RegisterName(string, interface{}) error
}

Satisfied by any object that has a RegisterName method, like *rpc.Server.

Jump to

Keyboard shortcuts

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