Documentation ¶
Index ¶
- Constants
- type AuthGenericRequest
- type ErrorCode
- type ErrorResponse
- type GetBaseInfoResponse
- type GetEnvResponse
- type GetServiceInfoResponse
- type SampleInfoResponse
- type SetHostnameArgs
- type SetRootPasswordArgs
- type SetupStatusResponse
- type ToggleSettingArgs
- type UserAuthenticateArgs
- type UserAuthenticateResponse
- type UserChangePasswordArgs
- type VerificationProgressResponse
Constants ¶
const ( // OpRPCCall is prepended to every rpc response messages, to indicate that the message is rpc response and not a notification. OpRPCCall = "r" // OpUCanHasSampleInfo notifies when new SampleInfo data is available. OpUCanHasSampleInfo = "d" // OpUCanHasVerificationProgress notifies when new VerificationProgress data is available. OpUCanHasVerificationProgress = "v" // OpServiceInfoChanged notifies when the GetServiceInfo data changed. OpServiceInfoChanged = "s" )
Put notification constants here. Notifications for new rpc data should have the format 'OpUCanHas' + 'RPC Method Name'.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthGenericRequest ¶
type AuthGenericRequest struct {
Token string
}
AuthGenericRequest is a struct that acts as a generic request struct
type ErrorCode ¶
type ErrorCode string
ErrorCode is a unique and short string code represeting an Error
const ( // ErrorScriptNotFound is thrown if either the bbb-cmd.sh or bbb-config.sh scripts are not found ErrorScriptNotFound ErrorCode = "SCRIPT_NOT_FOUND" // ErrorScriptNotSuperuser is thrown if a run scripts need to be run as superuser. ErrorScriptNotSuperuser ErrorCode = "SCRIPT_NOT_RUN_AS_SUPERUSER" // ErrorScriptIncludesNotFound is thrown when a script includes other bash functions, but the inclusion path (in the script) is invalid. ErrorScriptIncludesNotFound = "SCRIPT_INCLUDES_NOT_FOUND" // ErrorRedisError is a general Redis related error. // There is no differentiation of Redis errors because the front-end most likely handles them similar. ErrorRedisError ErrorCode = "REDIS_ERROR" // ErrorPrometheusError is a general Prometheus related error. // There is no differentiation of Prometheus errors because the front-end most likely handles them similar. ErrorPrometheusError ErrorCode = "PROMETHEUS_ERROR" // ErrorUnexpected is thrown when a a unknown/unhandled/unexpected error occurrs. // It's a catch-all error. ErrorUnexpected ErrorCode = "UNEXPECTED_ERROR" )
const ( // ErrorCmdScriptInvalidArg is thrown if the argument for the bbb-cmd.sh script is not known. // Not to be confused with ErrorConfigScriptInvalidArg which is for the bbb-config.sh. ErrorCmdScriptInvalidArg ErrorCode = "CMD_SCRIPT_INVALID_ARG" // ErrorFlashdriveCheckMultiple is thrown if multiple USB flashdrives are found. Needs exacly one. ErrorFlashdriveCheckMultiple ErrorCode = "FLASHDRIVE_CHECK_MULTI" // ErrorFlashdriveCheckNone is thrown if no USB flashdrive is found. ErrorFlashdriveCheckNone ErrorCode = "FLASHDRIVE_CHECK_NONE" // ErrorFlashdriveMountNotFound is thrown if no flashdrive found on the passed <path>. ErrorFlashdriveMountNotFound ErrorCode = "FLASHDRIVE_MOUNT_NOT_FOUND" // ErrorFlashdriveMountNotUnique is thrown if the passed <path> does not uniquely identify a flashdrive. ErrorFlashdriveMountNotUnique ErrorCode = "FLASHDRIVE_MOUNT_NOT_UNIQUE" // ErrorFlashdriveMountNotSupported is thrown if the flashdrive is either bigger than 64GB or the filesystem is not supported. ErrorFlashdriveMountNotSupported ErrorCode = "FLASHDRIVE_MOUNT_NOT_SUPPORTED" // ErrorFlashdriveUnmountNotMounted is thrown if there is no flashdrive to unmount at /mnt/backup. ErrorFlashdriveUnmountNotMounted ErrorCode = "FLASHDRIVE_UNMOUNT_NOT_MOUNTED" // ErrorBackupSysconfigNotAMountpoint is thrown if /mnt/backup is no mountpoint. It's needed to backup the sysconfig. ErrorBackupSysconfigNotAMountpoint ErrorCode = "BACKUP_SYSCONFIG_NOT_A_MOUNTPOINT" // ErrorRestoreSysconfigBackupNotFound is thrown if the backup file /mnt/backup/bbb-backup.rdb is not found. ErrorRestoreSysconfigBackupNotFound ErrorCode = "RESTORE_SYSCONFIG_BACKUP_NOT_FOUND" // ErrorMenderUpdateImageNotMenderEnabled is thrown if the image is not mender enabled. ErrorMenderUpdateImageNotMenderEnabled ErrorCode = "MENDER_UPDATE_IMAGE_NOT_MENDER_ENABLED" // ErrorMenderUpdateInstallFailed is thrown if `mender -install` failed. ErrorMenderUpdateInstallFailed ErrorCode = "MENDER_UPDATE_INSTALL_FAILED" // ErrorMenderUpdateNoVersion thrown if no firmware version passed to the script. ErrorMenderUpdateNoVersion ErrorCode = "MENDER_UPDATE_NO_VERSION" // ErrorMenderUpdateInvalidVersion is thrown if an invalid firmware version passed to the script. ErrorMenderUpdateInvalidVersion ErrorCode = "MENDER_UPDATE_INVALID_VERSION" // ErrorMenderUpdateCommitFailed is thrown if `mender -commit` failed. ErrorMenderUpdateCommitFailed ErrorCode = "MENDER_UPDATE_COMMIT_FAILED" )
const ( // ErrorConfigScriptInvalidArg is thrown if the argument for the bbb-config.sh script is not known. // Not to be confused with ErrorCmdScriptInvalidArg for the bbb-cmd script. ErrorConfigScriptInvalidArg ErrorCode = "CONFIG_SCRIPT_INVALID_ARG" // ErrorEnableClearnetIBDTorAlreadyDisabled is thrown if the tor service is already disabled for the whole system, cannot enable IBD over clearnet. ErrorEnableClearnetIBDTorAlreadyDisabled ErrorCode = "ENABLE_CLEARNETIBD_TOR_ALREADY_DISABLED" // ErrorSetNeedsTwoArguments is thrown if `bbb-config.sh set <key> <value>` is thrown with not exactly two arguments. ErrorSetNeedsTwoArguments ErrorCode = "SET_NEEDS_TWO_ARGUMENTS" // ErrorSetBitcoinNetworkInvalidValue is thrown if the set <value> is not "testnet" or "mainnet". ErrorSetBitcoinNetworkInvalidValue ErrorCode = "SET_BITCOINETWORK_INVALID_VALUE" // ErrorSetBitcoinDBCacheInvalidValue is thrown if the <value> is not an integer in MB between 50 and 3000. ErrorSetBitcoinDBCacheInvalidValue ErrorCode = "SET_BITCOINDBCACHE_INVALID_VALUE" // ErrorSetHostnameInvalidValue is thrown if the <value> is an invalid hostname according to this regex '^[a-z][a-z0-9-]{0,22}[a-z0-9]$'. ErrorSetHostnameInvalidValue ErrorCode = "SET_HOSTNAME_INVALID_VALUE" )
const ( // ErrorDummyAuthenticationNotSuccessful is thrown if the dummy autentication is not successful. ErrorDummyAuthenticationNotSuccessful ErrorCode = "DUMMY_AUTHENTICATION_NOT_SUCCESSFUL" // ErrorDummyPasswordTooShort is thrown if the provided password is too short. ErrorDummyPasswordTooShort ErrorCode = "DUMMY_CHANGEPASSWORD_TOO_SHORT" // ErrorSetRootPasswordTooShort is thrown if the provided root password is too short. ErrorSetRootPasswordTooShort ErrorCode = "SET_ROOTPASSWORD_PASSWORD_TOO_SHORT" )
type ErrorResponse ¶
ErrorResponse is a generic RPC response indicating if a RPC call was successful or not. It can be embedded into other RPC responses that return values. In any case the ErrorResponse should be checked first, so that, if an error is returned, we ignore everything else in the response.
func (*ErrorResponse) Error ¶
func (err *ErrorResponse) Error() string
Error formats the ErrorResponse in the following two formats: If no error occoured:
ErrorResponse: Success: true
If an error occoured:
ErrorResponse: Success: false Code: <ERROR_CODE> Message: <message>
type GetBaseInfoResponse ¶
type GetBaseInfoResponse struct { ErrorResponse *ErrorResponse Status string `json:"status"` Hostname string `json:"hostname"` MiddlewareLocalIP string `json:"middlewareLocalIP"` MiddlewareLocalPort string `json:"middlewareLocalPort"` MiddlewareTorOnion string `json:"middlewareTorOnion"` MiddlewareTorPort string `json:"middlewareTorPort"` IsTorEnabled bool `json:"isTorEnabled"` IsBitcoindListening bool `json:"isBitcoindListening"` FreeDiskspace int64 `json:"freeDiskspace"` // in Byte TotalDiskspace int64 `json:"totalDiskspace"` // in Byte BaseVersion string `json:"baseVersion"` BitcoindVersion string `json:"bitcoindVersion"` LightningdVersion string `json:"lightningdVersion"` ElectrsVersion string `json:"electrsVersion"` }
GetBaseInfoResponse is the struct that get sent by the rpc server during a GetBaseInfo rpc call
type GetEnvResponse ¶
GetEnvResponse is the struct that gets sent by the rpc server during a GetSystemEnv call
type GetServiceInfoResponse ¶
type GetServiceInfoResponse struct { ErrorResponse *ErrorResponse `json:"errorResponse"` BitcoindBlocks int64 `json:"bitcoindBlocks"` BitcoindHeaders int64 `json:"bitcoindHeaders"` BitcoindVerificationProgress float64 `json:"bitcoindVerificationProgress"` BitcoindPeers int64 `json:"bitcoindPeers"` BitcoindIBD bool `json:"bitcoindIBD"` LightningdBlocks int64 `json:"lightningdBlocks"` ElectrsBlocks int64 `json:"electrsBlocks"` }
GetServiceInfoResponse is the struct that gets sent by the RPC server during a GetServiceInfo RPC call
type SampleInfoResponse ¶
type SampleInfoResponse struct { Blocks int64 `json:"blocks"` Difficulty float64 `json:"difficulty"` LightningAlias string `json:"lightningAlias"` }
SampleInfoResponse holds sample information from c-lightning and bitcoind. It is temporary for testing purposes
type SetHostnameArgs ¶
SetHostnameArgs is a struct that holds the to be set hostname
type SetRootPasswordArgs ¶
SetRootPasswordArgs is a struct that holds the to be set root password
type SetupStatusResponse ¶
SetupStatusResponse is the struct that gets sent by the rpc server during a SetupStatus rpc call. This call is not authenticated and serves as indicator for what to show during the base setup wizzard.
type ToggleSettingArgs ¶
ToggleSettingArgs is a generic message for settings that can be enabled or disabled
type UserAuthenticateArgs ¶
UserAuthenticateArgs is a struct that holds the arguments for the UserAuthenticate RPC call. The first rpc call should always authenticate first
type UserAuthenticateResponse ¶
type UserAuthenticateResponse struct { ErrorResponse *ErrorResponse Token string }
UserAuthenticateResponse is the struct that gets sent by the rpc server during a UserAuthenticate call. It contains the session's jwt token.
type UserChangePasswordArgs ¶
type UserChangePasswordArgs struct { Username string Password string NewPassword string Token string }
UserChangePasswordArgs is a struct that holds the arguments for the UserChangePassword RPC call
type VerificationProgressResponse ¶
type VerificationProgressResponse struct { Blocks int64 `json:"blocks"` Headers int64 `json:"headers"` VerificationProgress float64 `json:"verificationProgress"` }
VerificationProgressResponse is the struct that gets sent by the rpc server during a VerificationProgress rpc call