diff --git a/client/http/http.go b/client/http/http.go index 2b07108..a98cd33 100644 --- a/client/http/http.go +++ b/client/http/http.go @@ -59,7 +59,7 @@ func New(ctx context.Context, l log.Logger, url string, chainHash []byte, transp if err != nil { pn = defaultClientExec } - agent := fmt.Sprintf("drand-client-%s/1.0", path.Base(pn)) + agent := fmt.Sprintf("go-client-%s/2.0", path.Base(pn)) c := &httpClient{ root: url, client: createClient(transport), @@ -320,8 +320,12 @@ func (h *httpClient) Get(ctx context.Context, round uint64) (drand.Result, error req.Header.Set("User-Agent", h.Agent) randResponse, err := h.client.Do(req) - if err != nil || randResponse.StatusCode != nhttp.StatusOK { - resC <- httpGetResponse{nil, fmt.Errorf("doing request %v: %w", req, err)} + if err != nil { + resC <- httpGetResponse{nil, fmt.Errorf("error doing GET request to %q: %w", url, err)} + return + } + if randResponse.StatusCode != nhttp.StatusOK { + resC <- httpGetResponse{nil, fmt.Errorf("got invalid status %d doing GET request to %q", randResponse.StatusCode, url)} return } defer randResponse.Body.Close() diff --git a/internal/net/client.go b/internal/net/client.go deleted file mode 100644 index be7d4bd..0000000 --- a/internal/net/client.go +++ /dev/null @@ -1,16 +0,0 @@ -package net - -// HTTPClient is an optional extension to the protocol client relaying of HTTP over the GRPC connection. -import ( - "context" - "net/http" -) - -type Peer interface { - Address() string -} - -// it is currently used for relaying metrics between group members. -type HTTPClient interface { - HandleHTTP(ctx context.Context, p Peer) (http.Handler, error) -}