robot

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CertFilename = "AnkiRobotDeviceCert.pem"
	KeysFilename = "AnkiRobotDeviceKeys.pem"
)
View Source
const (
	GatewayKey  = "/tmp/anki/gateway/trust.key"
	GatewayCert = "/tmp/anki/gateway/trust.cert"
)

Variables

View Source
var DefaultCloudDir = "/factory/cloud"

Filenames and default directory for certificate/keys data

Functions

func AnkiVersion

func AnkiVersion() string

func BootID

func BootID() string

BootID returns the unique ID generated on each robot bootup

func CertCommonName

func CertCommonName(cloudDir string) (string, error)

CertCommonName returns the CommonName field stored in the certificate in the given factory directory

func CheckFactoryCloudFiles

func CheckFactoryCloudFiles(cloudDir, canonicalESN string) error

CheckFactoryCloudFiles checks that the factory-programmed "Cloud" directory has been populated with the expected files, and checks that the information in those files looks correct and is consistent with the robot's Electronic Serial Number (ESN).

cloudDir - path of the directory with cloud files. Eg "/factory/cloud".

canonicalESN - the ESN of the robot, in "canonical" string form with lowercase hexadecimal digits. Eg "00e00012" for the 32-bit ESN value 14680082.

func InstallCrashReporter

func InstallCrashReporter(procname string)

func OSUserAgent

func OSUserAgent() grpc.DialOption

OSUserAgent returns a grpc.DialOption that will set a user agent with the string: "Victor/<os_version>", if the OS version can be obtained. Otherwise, nil is returned.

func OSVersion

func OSVersion() string

OSVersion returns a string representation of the OS version, like: 4.15.0-33-generic.x86_64.GNU/Linux

func PEMData

func PEMData(cloudDir string) ([]byte, error)

PEMData returns the PEM data located in the given cloud factory directory's certificate file

func ParseX509Certificate

func ParseX509Certificate(cloudDir string) (*x509.Certificate, error)

ParseX509Certificate parses an x509 certificate from the given cloud factory directory

func ReadESN

func ReadESN() (string, error)

ReadESN returns the ESN of a robot (in this case a fake one)

func TLSKeyPair

func TLSKeyPair(cloudDir string) (tls.Certificate, error)

TLSKeyPair returns the public and private key in the given factory directory as a tls.Certificate

func UninstallCrashReporter

func UninstallCrashReporter()

func VictorVersion

func VictorVersion() string

func WriteFaceErrorCode

func WriteFaceErrorCode(code uint16) error

WriteFaceErrorCode writes the given numerical code to the robot's face with an error message

Types

type DeviceCertRecord

type DeviceCertRecord struct {
	CommonName             string `json:"CommonName"` // CN value in cert Distinguished Name
	KeysDigest             string `json:"KeysDigest"`
	CertDigest             string `json:"CertDigest"`
	CertSignatureAlgorithm string `json:"CertSignatureAlgorithm"`
	CertSignature          string `json:"CertSignature"`
}

DeviceCertRecord is a record of useful facts about an individual device certificate. The device may or may not be a robot.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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