Documentation ¶
Overview ¶
Package target is responsible for maintaining resources related to targets.
Index ¶
- Constants
- func ServoHost(ctx context.Context, role string, testVars map[string]string) string
- type Config
- type Conn
- type ConnCache
- func (cc *ConnCache) Close(ctx context.Context) error
- func (cc *ConnCache) Conn() *Conn
- func (cc *ConnCache) ConnectionSpec() string
- func (cc *ConnCache) DefaultTimeout() time.Duration
- func (cc *ConnCache) EnsureConn(ctx context.Context, rebootBeforeReconnect bool) error
- func (cc *ConnCache) InitBootID() string
- func (cc *ConnCache) ProxyCommand() string
- type ServiceConfig
- type Services
Constants ¶
const ( // SSHPingTimeout is the timeout for checking if SSH connection to DUT is open. SSHPingTimeout = 5 * time.Second )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { SSHConfig *protocol.SSHConfig Retries int TastVars map[string]string ServiceConfig *ServiceConfig }
Config contains configs for creating connection.
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn holds an SSH connection to a target device, as well as several other objects whose lifetime is tied to the connection such as SSH port forwards.
func (*Conn) SSHConn ¶
SSHConn returns an SSH connection. A returned connection is owned by Conn and should not be closed by users.
type ConnCache ¶
type ConnCache struct {
// contains filtered or unexported fields
}
ConnCache manages a cached connection to the target.
ConnCache is not goroutine-safe.
func NewConnCache ¶
func NewConnCache(ctx context.Context, cfg *Config, target, proxyCommand, role string) (cc *ConnCache, retErr error)
NewConnCache establishes a new connection to target and return a ConnCache. Call Close when it is no longer needed.
func (*ConnCache) Conn ¶
Conn returns a cached connection to the target.
A connection returned from this function is owned by ConnCache. Do not call its Close.
func (*ConnCache) ConnectionSpec ¶
ConnectionSpec returns a connection spec as [<user>@]host[:<port>].
func (*ConnCache) DefaultTimeout ¶
DefaultTimeout returns the default timeout for connection operations.
func (*ConnCache) EnsureConn ¶
EnsureConn ensures a cached connection to the target is available and healthy, possibly creating a new connection.
EnsureConn has slight performance hit because it checks the connection health by sending SSH ping. Unless you expect connection drops (e.g. after running test bundles), use Conn without calling this method.
Be aware that calling EnsureConn may invalidate a connection previously returned from Conn.
func (*ConnCache) InitBootID ¶
InitBootID returns a boot ID string obtained on the first successful connection to the target. An empty string is returned if it is unavailable.
func (*ConnCache) ProxyCommand ¶
ProxyCommand returns the proxy command.
type ServiceConfig ¶
type ServiceConfig struct { TLWServer string UseEphemeralDevserver bool Devservers []string TastDir string ExtraAllowedBuckets []string DebuggerPorts []int DebuggerPortForwarding bool }
ServiceConfig contains configs for creating a service.
type Services ¶
type Services struct {
// contains filtered or unexported fields
}
Services owns services exposed to a target by SSH port forwarding. Services is owned by Conn because its lifetime is tied to a corresponding SSH connection.
func (*Services) DUTServerAddr ¶
DUTServerAddr returns the address of port-forwarded TLW service accessible from the target, if available.
func (*Services) EphemeralDevserverURL ¶
EphemeralDevserverURL returns the URL of port-forwarded ephemeral devserver accessible from the target, if available.