Files
rpc/requester.go
zeekayandHanzo Dev c8a2045764 Go 1.27.1, and the code it can say more simply
Modules declare go 1.27.1 and the build images follow. go fix applied the
modernizers; omitzero is not applied, since it changes what the JSON says.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-16 19:13:22 -07:00

48 lines
799 B
Go

// Copyright (C) 2019-2025, Lux Industries, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package rpc
import (
"context"
"net/url"
)
var _ EndpointRequester = (*luxEndpointRequester)(nil)
type EndpointRequester interface {
SendRequest(ctx context.Context, method string, params any, reply any, options ...Option) error
}
type luxEndpointRequester struct {
uri string
}
func NewEndpointRequester(uri string) EndpointRequester {
return &luxEndpointRequester{
uri: uri,
}
}
func (e *luxEndpointRequester) SendRequest(
ctx context.Context,
method string,
params any,
reply any,
options ...Option,
) error {
uri, err := url.Parse(e.uri)
if err != nil {
return err
}
return SendJSONRequest(
ctx,
uri,
method,
params,
reply,
options...,
)
}