Documentation
¶
Overview ¶
Package proxy implements a transparent JSON-RPC proxy that dispatches to a jrpc2.Client.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
A Proxy is a JSON-RPC transparent proxy. It implements a jrpc2.Assigner that assigns each requested method to a handler that forwards the request to a server connected through a *jrpc2.Client.
func New ¶
New creates a proxy that dispatches inbound requests to the given client. The resulting value satisfies the jrpc2.Assigner interface, allowing it to be used as the assigner for a jrpc2.Server.
For example:
cli := jrpc2.NewClient(ch, clientOpts) ... s := jrpc2.NewServer(proxy.New(cli), &jrpc2.ServerOptions{ DisableBuiltin: true, // disable the proxy's rpc.* handlers })
func (*Proxy) Assign ¶
Assign implements part of the jrpc2.Assigner interface. All methods are assigned to the proxy's internal handler, which forwards them across the client.