mirror of
https://github.com/AthanorLabs/atomic-swap.git
synced 2026-01-09 14:18:03 -05:00
29 lines
549 B
Go
29 lines
549 B
Go
// Copyright 2023 The AthanorLabs/atomic-swap Authors
|
|
// SPDX-License-Identifier: LGPL-3.0-only
|
|
|
|
package rpcclient
|
|
|
|
import (
|
|
"github.com/libp2p/go-libp2p/core/peer"
|
|
|
|
"github.com/athanorlabs/atomic-swap/common/rpctypes"
|
|
)
|
|
|
|
// Query calls net_query.
|
|
func (c *Client) Query(who peer.ID) (*rpctypes.QueryPeerResponse, error) {
|
|
const (
|
|
method = "net_queryPeer"
|
|
)
|
|
|
|
req := &rpctypes.QueryPeerRequest{
|
|
PeerID: who,
|
|
}
|
|
res := &rpctypes.QueryPeerResponse{}
|
|
|
|
if err := c.post(method, req, res); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return res, nil
|
|
}
|