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 ¶
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.
type FindRoutesRequest ¶
type FindRoutesRequest struct {
Edges []routing.PathEdges
Opts *RouteOptions
}
FindRoutesRequest parses json body for /routes endpoint request
type HTTPResponse ¶
type HTTPResponse struct {
Error *HTTPError `json:"error,omitempty"`
Data interface{} `json:"data,omitempty"`
}
HTTPResponse represents http response struct
type MockClient ¶
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