Documentation ¶
Overview ¶
Package rpcclient contains the API to the physical device.
Package rpcclient manages the connection with the bitboxbase, establishing a websocket listener and sending events when receiving packets. It also acts as a rpc client for any external package wanting to communicate with the base
Index ¶
- type RPCClient
- func (rpcClient *RPCClient) BackupHSMSecret() (rpcmessages.ErrorResponse, error)
- func (rpcClient *RPCClient) BackupSysconfig() (rpcmessages.ErrorResponse, error)
- func (rpcClient *RPCClient) ChannelHash() (string, bool)
- func (rpcClient *RPCClient) Connect() error
- func (rpcClient *RPCClient) EnableClearnetIBD(toggleAction rpcmessages.ToggleSettingArgs) (rpcmessages.ErrorResponse, error)
- func (rpcClient *RPCClient) EnableRootLogin(toggleAction rpcmessages.ToggleSettingArgs) (rpcmessages.ErrorResponse, error)
- func (rpcClient *RPCClient) EnableTor(toggleAction rpcmessages.ToggleSettingArgs) (rpcmessages.ErrorResponse, error)
- func (rpcClient *RPCClient) EnableTorElectrs(toggleAction rpcmessages.ToggleSettingArgs) (rpcmessages.ErrorResponse, error)
- func (rpcClient *RPCClient) EnableTorMiddleware(toggleAction rpcmessages.ToggleSettingArgs) (rpcmessages.ErrorResponse, error)
- func (rpcClient *RPCClient) EnableTorSSH(toggleAction rpcmessages.ToggleSettingArgs) (rpcmessages.ErrorResponse, error)
- func (rpcClient *RPCClient) GetBaseInfo() (rpcmessages.GetBaseInfoResponse, error)
- func (rpcClient *RPCClient) GetEnv() (rpcmessages.GetEnvResponse, error)
- func (rpcClient *RPCClient) GetSampleInfo() (rpcmessages.SampleInfoResponse, error)
- func (rpcClient *RPCClient) GetServiceInfo() (rpcmessages.GetServiceInfoResponse, error)
- func (rpcClient *RPCClient) GetVerificationProgress() (rpcmessages.VerificationProgressResponse, error)
- func (rpcClient *RPCClient) Ping() (bool, error)
- func (rpcClient *RPCClient) RebootBase() (rpcmessages.ErrorResponse, error)
- func (rpcClient *RPCClient) ReindexBitcoin() (rpcmessages.ErrorResponse, error)
- func (rpcClient *RPCClient) RestoreHSMSecret() (rpcmessages.ErrorResponse, error)
- func (rpcClient *RPCClient) RestoreSysconfig() (rpcmessages.ErrorResponse, error)
- func (rpcClient *RPCClient) ResyncBitcoin() (rpcmessages.ErrorResponse, error)
- func (rpcClient *RPCClient) SetHostname(args rpcmessages.SetHostnameArgs) (rpcmessages.ErrorResponse, error)
- func (rpcClient *RPCClient) SetRootPassword(args rpcmessages.SetRootPasswordArgs) (rpcmessages.ErrorResponse, error)
- func (rpcClient *RPCClient) ShutdownBase() (rpcmessages.ErrorResponse, error)
- func (rpcClient *RPCClient) Stop()
- func (rpcClient *RPCClient) UserAuthenticate(args rpcmessages.UserAuthenticateArgs) (rpcmessages.ErrorResponse, error)
- func (rpcClient *RPCClient) UserChangePassword(args rpcmessages.UserChangePasswordArgs) (rpcmessages.ErrorResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RPCClient ¶
type RPCClient struct {
// contains filtered or unexported fields
}
RPCClient handles communication with the BitBox Base's rpc server
func NewRPCClient ¶
func NewRPCClient(address string, bitboxBaseConfigDir string, onChangeStatus func(bitboxbasestatus.Status), onEvent func(bitboxbasestatus.Event), onUnregister func() error) (*RPCClient, error)
NewRPCClient returns a new bitboxbase rpcClient.
func (*RPCClient) BackupHSMSecret ¶
func (rpcClient *RPCClient) BackupHSMSecret() (rpcmessages.ErrorResponse, error)
BackupHSMSecret makes a synchronous rpc call to the base and returns a ErrorResponse indicating if the called script was successfully executed.
func (*RPCClient) BackupSysconfig ¶
func (rpcClient *RPCClient) BackupSysconfig() (rpcmessages.ErrorResponse, error)
BackupSysconfig makes a synchronous rpc call to the base and returns a ErrorResponse indicating if the called script was successfully executed.
func (*RPCClient) ChannelHash ¶
ChannelHash returns the noise channel and a boolean to indicate if it is verified
func (*RPCClient) Connect ¶
Connect starts the websocket go routine, first checking if the middleware is reachable, then establishing a websocket connection, then authenticating and encrypting all further traffic with noise.
func (*RPCClient) EnableClearnetIBD ¶
func (rpcClient *RPCClient) EnableClearnetIBD(toggleAction rpcmessages.ToggleSettingArgs) (rpcmessages.ErrorResponse, error)
EnableClearnetIBD makes an rpc call to BitBoxBase that configures bitcoind to run over clearnet while in IBD mode based on rpcmessages.ToggleSettingArgs Enable/Disable
func (*RPCClient) EnableRootLogin ¶
func (rpcClient *RPCClient) EnableRootLogin(toggleAction rpcmessages.ToggleSettingArgs) (rpcmessages.ErrorResponse, error)
EnableRootLogin makes an rpc call to BitBoxBase that enables/disables login via the root user/password based on rpcmessages.ToggleSettingArgs Enable/Disable
func (*RPCClient) EnableTor ¶
func (rpcClient *RPCClient) EnableTor(toggleAction rpcmessages.ToggleSettingArgs) (rpcmessages.ErrorResponse, error)
EnableTor makes an rpc call to the Base that enables/disables the tor.service based on rpcmessages.ToggleSettingArgs Enable/Disable
func (*RPCClient) EnableTorElectrs ¶
func (rpcClient *RPCClient) EnableTorElectrs(toggleAction rpcmessages.ToggleSettingArgs) (rpcmessages.ErrorResponse, error)
EnableTorElectrs makes an rpc call to BitBoxBase that enables/disables the Tor hidden service for electrs based on rpcmessages.ToggleSettingArgs Enable/Disable
func (*RPCClient) EnableTorMiddleware ¶
func (rpcClient *RPCClient) EnableTorMiddleware(toggleAction rpcmessages.ToggleSettingArgs) (rpcmessages.ErrorResponse, error)
EnableTorMiddleware makes an rpc call to BitBoxBase that enables/disables the Tor hidden service for the middleware based on rpcmessages.ToggleSettingArgs Enable/Disable
func (*RPCClient) EnableTorSSH ¶
func (rpcClient *RPCClient) EnableTorSSH(toggleAction rpcmessages.ToggleSettingArgs) (rpcmessages.ErrorResponse, error)
EnableTorSSH makes an rpc call to BitBoxBase that enables/disables the tor hidden service for SSH based on rpcmessages.ToggleSettingArgs Enable/Disable
func (*RPCClient) GetBaseInfo ¶
func (rpcClient *RPCClient) GetBaseInfo() (rpcmessages.GetBaseInfoResponse, error)
GetBaseInfo makes a synchronous rpc call to the base and returns the GetBaseInfoResponse struct
func (*RPCClient) GetEnv ¶
func (rpcClient *RPCClient) GetEnv() (rpcmessages.GetEnvResponse, error)
GetEnv makes a synchronous rpc call to the base and returns the network type and electrs rpc port
func (*RPCClient) GetSampleInfo ¶
func (rpcClient *RPCClient) GetSampleInfo() (rpcmessages.SampleInfoResponse, error)
GetSampleInfo makes a synchronous rpc call to the base and returns the SampleInfoResponse struct
func (*RPCClient) GetServiceInfo ¶
func (rpcClient *RPCClient) GetServiceInfo() (rpcmessages.GetServiceInfoResponse, error)
GetServiceInfo makes a synchronous RPC call to the Base and returns the GetServiceInfoResponse struct
func (*RPCClient) GetVerificationProgress ¶
func (rpcClient *RPCClient) GetVerificationProgress() (rpcmessages.VerificationProgressResponse, error)
GetVerificationProgress makes a synchronous rpc call to the base and returns the VerificationProgressResponse struct
func (*RPCClient) Ping ¶
Ping sends a get request to the bitbox base's middleware root handler and returns true if successful
func (*RPCClient) RebootBase ¶
func (rpcClient *RPCClient) RebootBase() (rpcmessages.ErrorResponse, error)
RebootBase makes an rpc call to BitBoxBase that calls the bbb-cmd.sh script which initiates a `reboot`
func (*RPCClient) ReindexBitcoin ¶
func (rpcClient *RPCClient) ReindexBitcoin() (rpcmessages.ErrorResponse, error)
ReindexBitcoin makes a synchronous rpc call to the base and returns a ErrorResponse indicating if the called script was successfully executed.
func (*RPCClient) RestoreHSMSecret ¶
func (rpcClient *RPCClient) RestoreHSMSecret() (rpcmessages.ErrorResponse, error)
RestoreHSMSecret makes a synchronous rpc call to the base and returns a ErrorResponse indicating if the called script was successfully executed.
func (*RPCClient) RestoreSysconfig ¶
func (rpcClient *RPCClient) RestoreSysconfig() (rpcmessages.ErrorResponse, error)
RestoreSysconfig makes a synchronous rpc call to the base and returns a ErrorResponse indicating if the called script was successfully executed.
func (*RPCClient) ResyncBitcoin ¶
func (rpcClient *RPCClient) ResyncBitcoin() (rpcmessages.ErrorResponse, error)
ResyncBitcoin makes a synchronous rpc call to the base and returns a ErrorResponse indicating if the called script was successfully executed.
func (*RPCClient) SetHostname ¶
func (rpcClient *RPCClient) SetHostname(args rpcmessages.SetHostnameArgs) (rpcmessages.ErrorResponse, error)
SetHostname makes a synchronous rpc call to the base and returns a ErrorResponse indicating if the called script was successfully executed.
func (*RPCClient) SetRootPassword ¶
func (rpcClient *RPCClient) SetRootPassword(args rpcmessages.SetRootPasswordArgs) (rpcmessages.ErrorResponse, error)
SetRootPassword makes an rpc call to BitBoxBase that sets the systems root password
func (*RPCClient) ShutdownBase ¶
func (rpcClient *RPCClient) ShutdownBase() (rpcmessages.ErrorResponse, error)
ShutdownBase makes an rpc call to BitBoxBase that calls the bbb-cmd.sh script which initiates a `shutdown now`
func (*RPCClient) Stop ¶
func (rpcClient *RPCClient) Stop()
Stop shuts down the websocket connection with the base
func (*RPCClient) UserAuthenticate ¶
func (rpcClient *RPCClient) UserAuthenticate(args rpcmessages.UserAuthenticateArgs) (rpcmessages.ErrorResponse, error)
UserAuthenticate makes a synchronous rpc call to the base and returns a ErrorResponse indicating if the user is successfully authenticated.
func (*RPCClient) UserChangePassword ¶
func (rpcClient *RPCClient) UserChangePassword(args rpcmessages.UserChangePasswordArgs) (rpcmessages.ErrorResponse, error)
UserChangePassword makes a synchronous rpc call to the base and returns a ErrorResponse indicating if the password has been successfully changed .