Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ConnectorVersion string
ConnectorVersion stores the version of the ShellHub Instane that is running the connector. It is used in the ShellHub Agents initialized by the connector when a container is started.
Functions ¶
This section is empty.
Types ¶
type Config ¶ added in v0.16.0
type Config struct { // Set the ShellHub server address the agent will use to connect. // This is required. ServerAddress string `env:"SERVER_ADDRESS,required"` // Specify the path to store the devices/containers private keys. // If not provided, the agent will generate a new one. // This is required. PrivateKeys string `env:"PRIVATE_KEYS,required"` // Sets the account tenant id used during communication to associate the // devices to a specific tenant. // This is required. TenantID string `env:"TENANT_ID,required"` // Determine the interval to send the keep alive message to the server. This // has a direct impact of the bandwidth used by the device when in idle // state. Default is 30 seconds. KeepAliveInterval int `env:"KEEPALIVE_INTERVAL,default=30"` }
Config provides the configuration for the agent connector service.
func LoadConfigFromEnv ¶ added in v0.16.0
type Connector ¶
type Connector interface { // List lists all containers running on the host. List(ctx context.Context) ([]Container, error) // Start starts the agent for the container with the given ID. Start(ctx context.Context, id string, name string) // Stop stops the agent for the container with the given ID. Stop(ctx context.Context, id string) // Listen listens for events and starts or stops the agent for the container that was created or removed. Listen(ctx context.Context) error }
Connector is an interface that defines the methods that a connector must implement.
type Container ¶
type Container struct { // ID is the container ID. ID string // Name is the container name. Name string // ServerAddress is the ShellHub address of the server that the agent will connect to. ServerAddress string // Tenant is the tenant ID of the namespace that the agent belongs to. Tenant string // PrivateKey is the private key of the device. Specify the path to store the container private key. If not // provided, the agent will generate a new one. This is required. PrivateKey string // Cancel is a function that is used to stop the goroutine that is running the agent for this container. Cancel context.CancelFunc }
Container is a struct that represents a container that will be managed by the connector.
type DockerConnector ¶
type DockerConnector struct {
// contains filtered or unexported fields
}
DockerConnector is a struct that represents a connector that uses Docker as the container runtime.
func (*DockerConnector) List ¶
func (d *DockerConnector) List(ctx context.Context) ([]Container, error)
func (*DockerConnector) Listen ¶
func (d *DockerConnector) Listen(ctx context.Context) error
Listen listens for events and starts or stops the agent for the containers.
Click to show internal directories.
Click to hide internal directories.