Documentation
¶
Index ¶
- Constants
- func ControlSocketName(_ RemoteCVDLocator, cs ConnStatus) string
- func DisconnectCVD(controlDir string, cvd RemoteCVDLocator, status ConnStatus) error
- func EnsureConnDirsExist(controlDir string) error
- func ExpandPath(path string) string
- func FindOrConnect(controlDir string, cvd RemoteCVDLocator, service client.Service, ...) (findOrConnRet, error)
- func GetHostOutRelativePath(targetArch string) (string, error)
- func GetProxySocketPath(controlDir, host, device string) string
- func ImportAcloudConfig(src, dst string) error
- func ListLocalImageRequiredFiles(buildTop, productOut string) ([]string, error)
- func LoadConfig(srcs []string, c *Config) error
- func PromptSelectionFromMap[K comparable, T any](c *command, choices map[K]T, toStr func(K, T) string, selOpt SelectionOption) (map[K]T, error)
- func PromptSelectionFromSlice[T any](c *command, choices []T, toStr func(T) string, selOpt SelectionOption) ([]T, error)
- func PromptSelectionFromSliceString(c *command, choices []string, selOpt SelectionOption) ([]string, error)
- func PromptYesOrNo(out *os.File, in *os.File, text string) (bool, error)
- func StateAsStr(state int) string
- func WriteListCVDsOutput(w io.Writer, hosts []*RemoteHost)
- type ADBServerProxy
- type ADBServerProxyImpl
- type AcloudConfig
- type AsArgs
- type AuthnConfig
- type CVDRemoteCommand
- type CVDRemoteFlags
- type CommandOptions
- type CommandRunner
- type Config
- type ConnController
- func (tc *ConnController) ADBPort() int
- func (tc *ConnController) OnADBDataChannel(dc *webrtc.DataChannel)
- func (tc *ConnController) OnClose()
- func (tc *ConnController) OnError(err error)
- func (tc *ConnController) OnFailure()
- func (tc *ConnController) Run()
- func (tc *ConnController) Status() ConnStatus
- func (tc *ConnController) Stop()
- type ConnStatus
- type ConnectFlags
- type CreateCVDFlags
- type CreateCVDLocalOpts
- type CreateCVDOpts
- type CreateGCPHostOpts
- type CreateHostFlags
- type CreateHostOpts
- type CredentialsFactory
- type DeleteCVDFlags
- type Forwarder
- type ForwarderState
- type GCPHostConfig
- type HTTPBasicAuthnConfig
- type HostConfig
- type IOStreams
- type ListCVDsFlags
- type MissingEnvVarErr
- type OIDCTokenConfig
- type RemoteCVD
- type RemoteCVDLocator
- type RemoteHost
- type SelectionOption
- type Service
- type StatusCmdRes
- type UsernameSrcType
Constants ¶
const ( ConnectCommandName = "connect" DisconnectCommandName = "disconnect" ConnectionWebRTCAgentCommandName = "webrtc_agent" ConnectionProxyAgentCommandName = "proxy_agent" ConnectionWebSocketAgentCommandName = "websocket_agent" )
const ( FwdInitializing = iota // 0: The initial state after creation FwdReady = iota FwdConnected = iota FwdStopped = iota FwdFailed = iota )
const ( NoneCredentialsSource = "none" InjectedCredentialsSource = "injected" )
const ( CVDHostPackageDirName = "cvd-host_package" CVDHostPackageName = "cvd-host_package.tar.gz" )
const ( AndroidBuildTopVarName = "ANDROID_BUILD_TOP" AndroidProductOutVarName = "ANDROID_PRODUCT_OUT" )
const ADBServerPort = 5037
const RequiredImagesFilename = "device/google/cuttlefish/required_images"
Variables ¶
This section is empty.
Functions ¶
func ControlSocketName ¶
func ControlSocketName(_ RemoteCVDLocator, cs ConnStatus) string
func DisconnectCVD ¶
func DisconnectCVD(controlDir string, cvd RemoteCVDLocator, status ConnStatus) error
func EnsureConnDirsExist ¶
func ExpandPath ¶
func FindOrConnect ¶
func GetHostOutRelativePath ¶
func GetProxySocketPath ¶
func ImportAcloudConfig ¶
func ListLocalImageRequiredFiles ¶
List the required filenames to create a cuttlefish instance given the `build top` and `product out` values from an environment where Android was built.
func LoadConfig ¶
func PromptSelectionFromMap ¶
func PromptSelectionFromMap[K comparable, T any](c *command, choices map[K]T, toStr func(K, T) string, selOpt SelectionOption) (map[K]T, error)
func PromptSelectionFromSlice ¶
func PromptSelectionFromSlice[T any](c *command, choices []T, toStr func(T) string, selOpt SelectionOption) ([]T, error)
The PromptSelectionFromSlice<Type> functions iterate over given container and present users with a prompt like this: 0: String representation of first choice 2: String representation of second choice ... N: All Choose an option: <cursor> These should have been methods of command, but Go doesn't allow generic methods.
func PromptSelectionFromSliceString ¶
func PromptSelectionFromSliceString(c *command, choices []string, selOpt SelectionOption) ([]string, error)
func StateAsStr ¶
func WriteListCVDsOutput ¶
func WriteListCVDsOutput(w io.Writer, hosts []*RemoteHost)
Types ¶
type ADBServerProxy ¶
type ADBServerProxyImpl ¶
type ADBServerProxyImpl struct{}
func (*ADBServerProxyImpl) Connect ¶
func (p *ADBServerProxyImpl) Connect(port int) error
func (*ADBServerProxyImpl) ConnectWithLocalFileSystem ¶
func (p *ADBServerProxyImpl) ConnectWithLocalFileSystem(path string) error
func (*ADBServerProxyImpl) Disconnect ¶
func (p *ADBServerProxyImpl) Disconnect(port int) error
func (*ADBServerProxyImpl) DisconnectWithLocalFileSystem ¶
func (p *ADBServerProxyImpl) DisconnectWithLocalFileSystem(path string) error
type AcloudConfig ¶
type AuthnConfig ¶
type AuthnConfig struct { OIDCToken *OIDCTokenConfig `json:"oidc_token,omitempty"` HTTPBasicAuthn *HTTPBasicAuthnConfig `json:"http_basic_authn,omitempty"` }
type CVDRemoteCommand ¶
type CVDRemoteCommand struct {
// contains filtered or unexported fields
}
func NewCVDRemoteCommand ¶
func NewCVDRemoteCommand(o *CommandOptions) *CVDRemoteCommand
func (*CVDRemoteCommand) Execute ¶
func (c *CVDRemoteCommand) Execute() error
type CVDRemoteFlags ¶
func (*CVDRemoteFlags) AsArgs ¶
func (f *CVDRemoteFlags) AsArgs() []string
type CommandOptions ¶
type CommandOptions struct { IOStreams Args []string InitialConfig Config ServiceBuilder client.ServiceBuilder CommandRunner CommandRunner ADBServerProxy ADBServerProxy }
type CommandRunner ¶
type Config ¶
type Config struct { // Default service, service to be used in case none other was selected. SystemDefaultService string `json:"system_default_service,omitempty"` // [OPTIONAL] If set, it overrides the `SystemDefaultService` parameter. UserDefaultService string `json:"user_default_service,omitempty"` Services map[string]*Service `json:"services,omitempty"` ConnectionControlDir string `json:"connection_control_dir,omitempty"` KeepLogFilesDays int `json:"keep_log_files_days,omitempty"` }
func BaseConfig ¶
func BaseConfig() *Config
func (*Config) ConnectionControlDirExpanded ¶
func (*Config) DefaultService ¶
func (*Config) LogFilesDeleteThreshold ¶
type ConnController ¶
type ConnController struct {
// contains filtered or unexported fields
}
Controls the webrtc connection maintained between the connection agent and a cvd. Implements the Observer interface for the webrtc client.
func NewConnController ¶
func NewConnController( controlDir string, service client.Service, cvd RemoteCVDLocator, localICEConfig *wclient.ICEConfig) (*ConnController, error)
func (*ConnController) ADBPort ¶
func (tc *ConnController) ADBPort() int
func (*ConnController) OnADBDataChannel ¶
func (tc *ConnController) OnADBDataChannel(dc *webrtc.DataChannel)
func (*ConnController) OnClose ¶
func (tc *ConnController) OnClose()
func (*ConnController) OnError ¶
func (tc *ConnController) OnError(err error)
func (*ConnController) OnFailure ¶
func (tc *ConnController) OnFailure()
func (*ConnController) Run ¶
func (tc *ConnController) Run()
func (*ConnController) Status ¶
func (tc *ConnController) Status() ConnStatus
func (*ConnController) Stop ¶
func (tc *ConnController) Stop()
type ConnStatus ¶
type ConnStatus struct {
ADB ForwarderState
}
func ConnectDevice ¶
func ConnectDevice(host, device, ice_config, agent string, c *command, opts *subCommandOpts) (*ConnStatus, error)
Starts a connection agent process and waits for it to report the connection was successfully created or an error occurred.
type ConnectFlags ¶
type ConnectFlags struct { *CVDRemoteFlags // contains filtered or unexported fields }
func (*ConnectFlags) AsArgs ¶
func (f *ConnectFlags) AsArgs() []string
type CreateCVDFlags ¶
type CreateCVDFlags struct { *CVDRemoteFlags *CreateCVDOpts *CreateHostOpts }
type CreateCVDLocalOpts ¶
type CreateCVDOpts ¶
type CreateCVDOpts struct { Host string MainBuild hoapi.AndroidCIBuild KernelBuild hoapi.AndroidCIBuild BootloaderBuild hoapi.AndroidCIBuild SystemImgBuild hoapi.AndroidCIBuild LocalImage bool // Creates multiple instances. Only relevant if given a single build source. NumInstances int // Structure: https://android.googlesource.com/device/google/cuttlefish/+/8bbd3b9cd815f756f332791d45c4f492b663e493/host/commands/cvd/parser/README.md // Example: https://cs.android.com/android/platform/superproject/main/+/main:device/google/cuttlefish/host/cvd_test_configs/main_phone-main_watch.json;drc=b2e8f4f014abb7f9cb56c0ae199334aacb04542d EnvConfig map[string]interface{} // If true, perform the ADB connection automatically. AutoConnect bool BuildAPICredentialsSource string CreateCVDLocalOpts }
func (*CreateCVDOpts) AdditionalInstancesNum ¶
func (o *CreateCVDOpts) AdditionalInstancesNum() uint32
type CreateGCPHostOpts ¶
type CreateHostFlags ¶
type CreateHostFlags struct { *CVDRemoteFlags *CreateHostOpts }
type CreateHostOpts ¶
type CreateHostOpts struct {
GCP CreateGCPHostOpts
}
type CredentialsFactory ¶
type CredentialsFactory func() string
type DeleteCVDFlags ¶
type DeleteCVDFlags struct { *CVDRemoteFlags Host string }
type Forwarder ¶
type Forwarder struct {
// contains filtered or unexported fields
}
Forwards messages between a local TCP server and a webrtc data channel.
func (*Forwarder) OnDataChannel ¶
func (f *Forwarder) OnDataChannel(dc *webrtc.DataChannel)
func (*Forwarder) State ¶
func (f *Forwarder) State() ForwarderState
func (*Forwarder) StopForwarding ¶
type ForwarderState ¶
type GCPHostConfig ¶
type HTTPBasicAuthnConfig ¶
type HTTPBasicAuthnConfig struct {
UsernameSrc UsernameSrcType `json:"username_src,omitempty"`
}
type HostConfig ¶
type HostConfig struct {
GCP GCPHostConfig `json:"gcp,omitempty"`
}
type ListCVDsFlags ¶
type ListCVDsFlags struct { *CVDRemoteFlags Host string }
type MissingEnvVarErr ¶
type MissingEnvVarErr string
func (MissingEnvVarErr) Error ¶
func (s MissingEnvVarErr) Error() string
type OIDCTokenConfig ¶
type OIDCTokenConfig struct {
TokenFile string `json:"token_file,omitempty"`
}
type RemoteCVD ¶
type RemoteCVD struct { RemoteCVDLocator Status string Displays []string ConnStatus *ConnStatus }
type RemoteCVDLocator ¶
type RemoteCVDLocator struct { ServiceRootEndpoint string `json:"service_root_endpoint"` Host string `json:"host"` // Identifier within the whole fleet. ID string `json:"id"` // Identifier within a group. Name string `json:"name"` // Instead of `Name`, `WebRTCDeviceID` is the identifier used for setting up the adb connections. It // contains the group name and the device name, eg: "cvd-1_1". WebRTCDeviceID string `json:"webrtc_device_id"` // ADB port of Cuttlefish instance. ADBSerial string `json:"adb_serial"` }
type RemoteHost ¶
type SelectionOption ¶
type SelectionOption int32
const ( Single SelectionOption = 0 AllowAll SelectionOption = 1 << iota )
type Service ¶
type Service struct { ServiceURL string `json:"service_url,omitempty"` Zone string `json:"zone,omitempty"` Proxy string `json:"proxy,omitempty"` BuildAPICredentialsSource string `json:"build_api_credentials_source,omitempty"` Host *HostConfig `json:"host,omitempty"` Authn *AuthnConfig `json:"authn,omitempty"` }
type StatusCmdRes ¶
type StatusCmdRes struct { CVD RemoteCVDLocator Status ConnStatus }