Imports #
"encoding/json"
"fmt"
"io"
"net"
"net/rpc"
"sync"
"encoding/json"
"errors"
"io"
"net/rpc"
"sync"
"encoding/json"
"fmt"
"io"
"net"
"net/rpc"
"sync"
"encoding/json"
"errors"
"io"
"net/rpc"
"sync"
var errMissingParams = *ast.CallExpr
var null = *ast.CallExpr
type clientCodec struct {
dec *json.Decoder
enc *json.Encoder
c io.Closer
req clientRequest
resp clientResponse
mutex sync.Mutex
pending map[uint64]string
}
type clientRequest struct {
Method string `json:"method"`
Params [1]any `json:"params"`
Id uint64 `json:"id"`
}
type clientResponse struct {
Id uint64 `json:"id"`
Result *json.RawMessage `json:"result"`
Error any `json:"error"`
}
type serverCodec struct {
dec *json.Decoder
enc *json.Encoder
c io.Closer
req serverRequest
mutex sync.Mutex
seq uint64
pending map[uint64]*json.RawMessage
}
type serverRequest struct {
Method string `json:"method"`
Params *json.RawMessage `json:"params"`
Id *json.RawMessage `json:"id"`
}
type serverResponse struct {
Id *json.RawMessage `json:"id"`
Result any `json:"result"`
Error any `json:"error"`
}
func (c *serverCodec) Close() error
func (c *clientCodec) Close() error
Dial connects to a JSON-RPC server at the specified network address.
func Dial(network string, address string) (*rpc.Client, error)
NewClient returns a new [rpc.Client] to handle requests to the set of services at the other end of the connection.
func NewClient(conn io.ReadWriteCloser) *rpc.Client
NewClientCodec returns a new [rpc.ClientCodec] using JSON-RPC on conn.
func NewClientCodec(conn io.ReadWriteCloser) rpc.ClientCodec
NewServerCodec returns a new [rpc.ServerCodec] using JSON-RPC on conn.
func NewServerCodec(conn io.ReadWriteCloser) rpc.ServerCodec
func (c *serverCodec) ReadRequestBody(x any) error
func (c *serverCodec) ReadRequestHeader(r *rpc.Request) error
func (c *clientCodec) ReadResponseBody(x any) error
func (c *clientCodec) ReadResponseHeader(r *rpc.Response) error
ServeConn runs the JSON-RPC server on a single connection. ServeConn blocks, serving the connection until the client hangs up. The caller typically invokes ServeConn in a go statement.
func ServeConn(conn io.ReadWriteCloser)
func (c *clientCodec) WriteRequest(r *rpc.Request, param any) error
func (c *serverCodec) WriteResponse(r *rpc.Response, x any) error
func (r *serverRequest) reset()
func (r *clientResponse) reset()
Generated with Arrow