Help us shape the future of Go! Take the 2026 Go Developer Survey

rfclient

package
v1.3.103 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package rfclient pkg/rfclient/client.go c2-net-routing

This file holds the net/http-backed implementation (NewHTTP) and is native-only; the net/http-free interface and types live in types.go so pkg/router compiles under the TinyGo js/wasm target.

Package rfclient pkg/rfclient/types.go c2-net-routing

Index

Constants

This section is empty.

Variables

View Source
var ErrTransportNotFound = errors.New("transport not found")

ErrTransportNotFound is returned when transport is not found.

Functions

This section is empty.

Types

type Client

type Client interface {
	FindRoutes(ctx context.Context, rts []routing.PathEdges, opts *RouteOptions) (map[routing.PathEdges][][]routing.Hop, error)
}

Client implements route finding operations.

The interface and its request/response types live here, free of net/http, so consumers (notably pkg/router) compile under the TinyGo js/wasm target where net/http is unavailable. The HTTP implementation (NewHTTP) lives in the build-tagged client.go and is native-only.

func NewHTTP

func NewHTTP(addr string, apiTimeout time.Duration, client *http.Client, mlogger *logging.MasterLogger) Client

NewHTTP constructs new Client that communicates over http.

type FindRoutesRequest

type FindRoutesRequest struct {
	Edges []routing.PathEdges
	Opts  *RouteOptions
}

FindRoutesRequest parses json body for /routes endpoint request

type HTTPError

type HTTPError struct {
	Message string `json:"message"`
	Code    int    `json:"code"`
}

HTTPError is included in an HTTPResponse

type HTTPResponse

type HTTPResponse struct {
	Error *HTTPError  `json:"error,omitempty"`
	Data  interface{} `json:"data,omitempty"`
}

HTTPResponse represents http response struct

type MockClient

type MockClient struct {
	mock.Mock
}

MockClient is an autogenerated mock type for the Client type

func NewMockClient

func NewMockClient(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockClient

NewMockClient creates a new instance of MockClient. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockClient) FindRoutes

func (_m *MockClient) FindRoutes(ctx context.Context, rts []routing.PathEdges, opts *RouteOptions) (map[routing.PathEdges][][]routing.Hop, error)

FindRoutes provides a mock function with given fields: ctx, rts, opts

type RouteOptions

type RouteOptions struct {
	MinHops uint16
	MaxHops uint16
	// NumRoutes is the desired number of distinct routes per edge the
	// finder should return. Zero means "use the service default"
	// (maxNumberOfRoutes). Callers requesting a multiplexed dial set
	// this to the mux degree (+ headroom) so the finder returns enough
	// disjoint legs instead of the hard-coded default — without it the
	// finder caps at 3 routes and any --forward-mux/--reverse-mux above
	// that silently degrades. See router.findRouteOptions.
	NumRoutes uint16
}

RouteOptions represents options for FindRoutesRequest

Jump to

Keyboard shortcuts

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