proxy

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: Apache-2.0 Imports: 21 Imported by: 2

Documentation

Overview

Package proxy implements a REST API for sending commands to Tesla vehicles.

See the Fleet API documentation for available endpoints.

Index

Constants

View Source
const (
	DefaultTimeout = 10 * time.Second
)

Variables

View Source
var (
	// ErrCommandNotImplemented indicates a command has not be implemented in the SDK
	ErrCommandNotImplemented = errors.New("command not implemented")

	// ErrCommandUseRESTAPI indicates vehicle/command is not supported by the protocol
	ErrCommandUseRESTAPI = errors.New("command requires using the REST API")
)

Functions

func ExtractCommandAction added in v0.0.2

func ExtractCommandAction(ctx context.Context, command string, params RequestParameters) (func(*vehicle.Vehicle) error, error)

ExtractCommandAction use command to define which action should be executed.

Types

type Proxy

type Proxy struct {
	Timeout time.Duration
	// contains filtered or unexported fields
}

Proxy exposes an HTTP API for sending vehicle commands.

func New

func New(ctx context.Context, skey protocol.ECDHPrivateKey, cacheSize int) (*Proxy, error)

New creates an http proxy.

Vehicles must have the public part of skey enrolled on their keychains. (This is a command-authentication key, not a TLS key.)

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(w http.ResponseWriter, req *http.Request)

type RequestParameters added in v0.0.2

type RequestParameters map[string]interface{}

RequestParameters allows simple type check

type Response

type Response struct {
	Response   interface{} `json:"response"`
	Error      string      `json:"error"`
	ErrDetails string      `json:"error_description"`
}

Response contains a server's response to a client request.

Jump to

Keyboard shortcuts

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