backend

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config *Config) *Client

func (*Client) GetConnection

func (c *Client) GetConnection() grpc.ClientConnInterface

func (*Client) GetConnectionStatus

func (c *Client) GetConnectionStatus() ConnectionStatus

func (*Client) RegisterListener

func (c *Client) RegisterListener() chan<- ConnectionStatus

func (*Client) Start

func (c *Client) Start(parent context.Context) error

Start the backend client and connect to server

func (*Client) Stop

func (c *Client) Stop() error

type Config

type Config struct {
	Addr string `mapstructure:"addr"` // Server address
	// TLS settings
	EnableTLS          bool   `mapstructure:"enable_tls"`           // Enable TLS connect to server
	ClientPemPath      string `mapstructure:"client_pem_path"`      // The file path of client.pem. The config only works when opening the TLS switch.
	ClientKeyPath      string `mapstructure:"client_key_path"`      // The file path of client.key. The config only works when opening the TLS switch.
	CaPemPath          string `mapstructure:"ca_pem_path"`          // The file path oca.pem. The config only works when opening the TLS switch.
	InsecureSkipVerify bool   `mapstructure:"insecure_skip_verify"` // Controls whether a client verifies the server's certificate chain and host name.
	Authentication     string `mapstructure:"authentication"`       // The auth value when send request
	CheckPeriod        int    `mapstructure:"check_period"`         // How frequently to check the connection(second)
}

type ConnectionStatus

type ConnectionStatus int8
const (
	Connected ConnectionStatus
	Disconnect
)

type Operator

type Operator interface {
	// GetConnection of rover to backend server
	GetConnection() grpc.ClientConnInterface
	// GetConnectionStatus of connection
	GetConnectionStatus() ConnectionStatus
	// RegisterListener of connection status change
	RegisterListener() chan<- ConnectionStatus
}

Jump to

Keyboard shortcuts

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