proxy

package
v0.14.25 Latest Latest
Warning

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

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

Documentation

Overview

Package proxy issues requests to the legacy mlab-ns service and parses responses.

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultLegacyServer is the default service for requesting nearest machines.
	DefaultLegacyServer = "https://mlab-ns.appspot.com"
)
View Source
var ErrNoContent = errors.New("no content from server")

ErrNoContent is returned when mlab-ns returns http.StatusNoContent.

Functions

func UnmarshalResponse

func UnmarshalResponse(req *http.Request, result interface{}) (*http.Response, error)

UnmarshalResponse reads the response from the given request and unmarshals the value into the given result.

Types

type LegacyLocator

type LegacyLocator struct {
	Server url.URL
	// contains filtered or unexported fields
}

LegacyLocator manages requests to the legacy mlab-ns service.

func MustNewLegacyLocator

func MustNewLegacyLocator(u, project string) *LegacyLocator

MustNewLegacyLocator creates a new LegacyLocator instance. If the given url fails to parse, the function will exit.

func (*LegacyLocator) Nearest

func (ll *LegacyLocator) Nearest(ctx context.Context, service, lat, lon string) ([]v2.Target, error)

Nearest discovers the nearest machines for the target service, using a proxied request to the LegacyServer such as mlab-ns.

Jump to

Keyboard shortcuts

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