Documentation ¶
Index ¶
Constants ¶
const ( // DefaultEndpoint is the endpoint used if none is provided DefaultEndpoint = "scada.hashicorp.com:7223" // DefaultBackoff is the amount of time we back off if we encounter // and error, and no specific backoff is available. DefaultBackoff = 120 * time.Second // DisconnectDelay is how long we delay the disconnect to allow // the RPC to complete. DisconnectDelay = time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CapabilityProvider ¶
type CapabilityProvider func(capability string, meta map[string]string, conn io.ReadWriteCloser) error
CapabilityProvider is used to provide a given capability when requested remotely. They must return a connection that is bridged or an error.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a SCADA compatible client. This is a bare bones client that only handles the framing and RPC protocol. Higher-level clients should be prefered.
func (*Client) NumStreams ¶
NumStreams returns the number of open streams on the client
type ConnectRequest ¶
type ConnectResponse ¶
type ConnectResponse struct {
Success bool
}
type DisconnectRequest ¶
type DisconnectResponse ¶
type DisconnectResponse struct { }
type FlashRequest ¶
type FlashResponse ¶
type FlashResponse struct { }
type HandshakeRequest ¶
type HandshakeRequest struct { Service string ServiceVersion string Capabilities map[string]int Meta map[string]string ResourceType string ResourceGroup string Token string }
HandshakeRequest is used to authenticate the session
type HandshakeResponse ¶
type HijackFunc ¶
type HijackFunc func(io.ReadWriteCloser)
type Opts ¶
type Opts struct { // Addr is the dial address Addr string // TLS controls if TLS is used TLS bool // TLSConfig or nil for default TLSConfig *tls.Config // Modifies the log output LogOutput io.Writer }
Opts is used to parameterize a Dial
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider is a high-level interface to SCADA by which clients declare themselves as a service providing capabilities. Provider manages the client/server interactions required, making it simpler to integrate.
func NewProvider ¶
func NewProvider(config *ProviderConfig) (*Provider, error)
NewProvider is used to create a new provider
func (*Provider) IsShutdown ¶
IsShutdown checks if we have been shutdown
func (*Provider) SessionAuthenticated ¶
SessionAuth checks if the current session is authenticated
type ProviderConfig ¶
type ProviderConfig struct { // Endpoint is the SCADA endpoint, defaults to DefaultEndpoint Endpoint string // Service is the service to expose Service *ProviderService // Handlers are invoked to provide the named capability Handlers map[string]CapabilityProvider // ResourceGroup is the named group e.g. "hashicorp/prod" ResourceGroup string // Token is the Atlas authentication token Token string // Optional TLS configuration, defaults used otherwise TLSConfig *tls.Config // LogOutput is to control the log output LogOutput io.Writer }
ProviderConfig is used to parameterize a provider