Documentation ¶
Overview ¶
Package rpc provides an RPC server for use in remote control and external application integration.
Index ¶
- Constants
- Variables
- func Dial(target string, opts ...DialOption) (conn *grpc.ClientConn, err error)
- func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *grpc.ClientConn, err error)
- func InitFlags(cmd *cobra.Command)
- func IsConfigured() chan bool
- func IsReady() chan bool
- func RunWith(r func(srv *grpc.Server), opts ...ServerOption)
- func Shutdown()
- func WhenStartFailed() chan error
- type BadgerStore
- type DialOption
- type Endpoint
- type MacaroonCredential
- type PrivateKey
- func (sk *PrivateKey) AsDeviceKey() device.NoisePrivateKey
- func (sk PrivateKey) Bytes() []byte
- func (sk *PrivateKey) Decode(key string)
- func (sk *PrivateKey) DecodeBytes(key []byte)
- func (sk PrivateKey) Encode() (key string)
- func (key PrivateKey) Equals(tar PrivateKey) bool
- func (sk PrivateKey) HexString() string
- func (sk PrivateKey) IsZero() bool
- func (sk *PrivateKey) PubKey() (pk PublicKey)
- type PublicKey
- type ServerOption
- type ServerOptions
- type Store
Constants ¶
View Source
const ( PrivateKeySize = 32 PublicKeySize = 32 )
View Source
const NullPort = 0
Variables ¶
View Source
var ( UnixPathFlag = "rpc-unix-listen" TunEnableFlag = "rpc-tun-enable" TunPortFlag = "rpc-tun-port" TunPeersFlag = "rpc-tun-peer" )
View Source
var (
ErrKeyNotExists error = errors.New("key not found")
)
Functions ¶
func Dial ¶
func Dial(target string, opts ...DialOption) (conn *grpc.ClientConn, err error)
func DialContext ¶
func DialContext(ctx context.Context, target string, opts ...DialOption) (conn *grpc.ClientConn, err error)
func IsConfigured ¶
func IsConfigured() chan bool
func RunWith ¶
func RunWith(r func(srv *grpc.Server), opts ...ServerOption)
func WhenStartFailed ¶
func WhenStartFailed() chan error
Types ¶
type BadgerStore ¶
type BadgerStore struct {
*badger.DB
}
func (*BadgerStore) GetKey ¶
func (s *BadgerStore) GetKey() (*PrivateKey, error)
func (*BadgerStore) Reset ¶
func (s *BadgerStore) Reset()
func (*BadgerStore) SetKey ¶
func (s *BadgerStore) SetKey(key *PrivateKey) error
type DialOption ¶
type DialOption interface {
// contains filtered or unexported methods
}
DialOption configures how we set up the connection.
func WithKeepAliveInterval ¶
func WithKeepAliveInterval(seconds int) DialOption
func WithPeer ¶
func WithPeer(pubKey string) DialOption
func WithPrivateKey ¶
func WithPrivateKey(key string) DialOption
type MacaroonCredential ¶
type MacaroonCredential struct{ macaroons.MacaroonCredential }
func NewMacaroonCredential ¶
func NewMacaroonCredential(m *macaroon.Macaroon) (MacaroonCredential, error)
NewMacaroonCredential returns a copy of the passed macaroon wrapped in a MacaroonCredential struct which implements PerRPCCredentials.
func (MacaroonCredential) RequireTransportSecurity ¶
func (m MacaroonCredential) RequireTransportSecurity() bool
RequireTransportSecurity implements the PerRPCCredentials interface.
type PrivateKey ¶
type PrivateKey [PrivateKeySize]byte
func DecodePrivateKey ¶
func DecodePrivateKey(key string) PrivateKey
func NewPrivateKey ¶
func NewPrivateKey() (*PrivateKey, error)
func (*PrivateKey) AsDeviceKey ¶
func (sk *PrivateKey) AsDeviceKey() device.NoisePrivateKey
func (PrivateKey) Bytes ¶
func (sk PrivateKey) Bytes() []byte
func (*PrivateKey) Decode ¶
func (sk *PrivateKey) Decode(key string)
func (*PrivateKey) DecodeBytes ¶
func (sk *PrivateKey) DecodeBytes(key []byte)
func (PrivateKey) Encode ¶
func (sk PrivateKey) Encode() (key string)
func (PrivateKey) Equals ¶
func (key PrivateKey) Equals(tar PrivateKey) bool
func (PrivateKey) HexString ¶
func (sk PrivateKey) HexString() string
func (PrivateKey) IsZero ¶
func (sk PrivateKey) IsZero() bool
func (*PrivateKey) PubKey ¶
func (sk *PrivateKey) PubKey() (pk PublicKey)
type PublicKey ¶
type PublicKey [PublicKeySize]byte
func DecodePublicKey ¶
func (PublicKey) AsDeviceKey ¶
func (sk PublicKey) AsDeviceKey() device.NoisePublicKey
type ServerOption ¶
type ServerOption interface {
// contains filtered or unexported methods
}
func WithDisableTunnel ¶
func WithDisableTunnel() ServerOption
func WithStore ¶
func WithStore(store Store) ServerOption
func WithTunOptions ¶
func WithTunOptions(port uint16, peers []string) ServerOption
func WithUnixPath ¶
func WithUnixPath(path string) ServerOption
type ServerOptions ¶
type ServerOptions struct {
// contains filtered or unexported fields
}
func Options ¶
func Options() *ServerOptions
func (*ServerOptions) GetTunPort ¶
func (s *ServerOptions) GetTunPort() uint16
type Store ¶
type Store interface { Reset() SetKey(key *PrivateKey) error GetKey() (*PrivateKey, error) }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.