proxy

package
v0.0.0-...-5969d1b Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Copyright 2023 Northern.tech AS

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Copyright 2023 Northern.tech AS

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Index

Constants

View Source
const (
	ProxyHost        = "127.0.0.1"
	InetAddrLoopback = "127.0.0.1:0"
)
View Source
const (
	ApiUrlDevicesPrefix         = "/api/devices/"
	ApiUrlDevicesAuthentication = "/api/devices/v1/authentication/"
	ApiUrlDevicesConnect        = "/api/devices/v1/deviceconnect/connect"
)

Variables

View Source
var (
	ErrNoAuthHeader = errors.New("no authorization header")
)

Functions

This section is empty.

Types

type ProxyController

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

ProxyController proxies device API requests to Mender server

func NewProxyController

func NewProxyController(
	client client.ApiRequester,
	dialer *websocket.Dialer,
	menderUrl, menderJwtToken string,
) (*ProxyController, error)

NewProxyController creates a new controller. If menderUrl and menderJwtToken are specified, the proxy is also started.

func (*ProxyController) CloseWsConnections

func (pc *ProxyController) CloseWsConnections()

func (ProxyController) DoWsUpgrade

func (pc ProxyController) DoWsUpgrade(
	ctx context.Context,
	w http.ResponseWriter,
	r *http.Request)

func (*ProxyController) GetServerUrl

func (pc *ProxyController) GetServerUrl() string

GetServerUrl returns the URL of the proxy

func (*ProxyController) Reconfigure

func (pc *ProxyController) Reconfigure(menderUrl, menderJwtToken string) error

Reconfigure reconfigures the local proxy server

func (*ProxyController) Start

func (pc *ProxyController) Start()

Start starts the local proxy server

func (*ProxyController) Stop

func (pc *ProxyController) Stop()

Stop stops the local proxy server

Jump to

Keyboard shortcuts

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