lotus/api/api_net.go
Phi-rjan b446a39a40
build: release: v1.27.1-rc2 (#12101)
* fix: ci: do not use deprecated --debug goreleaser flag (#12086)

* chore: deals: remove forgotten graphsync references (#12084)

* chore: types: remove more items forgotten after markets (#12095)

* chore: cleanup: remove more items forgotten after markets

* .gz somehow reappeared after https://github.com/filecoin-project/lotus/pull/11625

* fix: ETH RPC API: ETH Call should use the parent state root of the subsequent tipset (#11905)

* fix eth call

* tests

* changes as per review

* changes as per review

* Update node/impl/full/eth.go

Co-authored-by: Rod Vagg <rod@vagg.org>

* fix as per review

---------

Co-authored-by: Rod Vagg <rod@vagg.org>

* Update changelog to RC2

Update changelog to RC2

* Make gen / make docsgen-cli

Make gen / make docsgen-cli

* chore: api: the Net API/CLI now remains only on daemon

The only part of this repository that does lp2p is now lotus-daemon

Remove the CommonNet type, used exclusively bu the CLI stack

Adjust the rest of struct-memebership to match what went where

End result best seen in diff of `documentation/en/api-v0-methods-miner.md`

* Update changelog

Update changelog

* fix: events: sqlite db improvements (#12090)

* fix: events: sqlite db improvements

* fix unclosed multi-row query
* tune options to limit wal growth

Ref: https://github.com/filecoin-project/lotus/issues/12089

* fix: events: use correct context for CollectEvents transaction

* fix: events: close prepared read statement

* fix: events: close initial query; handle lint failures

* Update CHANGELOG.md

---------

Co-authored-by: Piotr Galar <piotr.galar@gmail.com>
Co-authored-by: Peter Rabbitson <ribasushi@protocol.ai>
Co-authored-by: Aarsh Shah <aarshkshah1992@gmail.com>
Co-authored-by: Rod Vagg <rod@vagg.org>
Co-authored-by: Peter Rabbitson <ribasushi@leporine.io>
2024-06-19 10:28:57 -04:00

73 lines
3.0 KiB
Go

package api
import (
"context"
"time"
"github.com/libp2p/go-libp2p/core/metrics"
"github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/protocol"
)
// MODIFYING THE API INTERFACE
//
// When adding / changing methods in this file:
// * Do the change here
// * Adjust implementation in `node/impl/`
// * Run `make gen` - this will:
// * Generate proxy structs
// * Generate mocks
// * Generate markdown docs
// * Generate openrpc blobs
type Net interface {
// MethodGroup: Net
NetConnectedness(context.Context, peer.ID) (network.Connectedness, error) //perm:read
NetPeers(context.Context) ([]peer.AddrInfo, error) //perm:read
NetPing(context.Context, peer.ID) (time.Duration, error) //perm:read
NetConnect(context.Context, peer.AddrInfo) error //perm:write
NetAddrsListen(context.Context) (peer.AddrInfo, error) //perm:read
NetDisconnect(context.Context, peer.ID) error //perm:write
NetFindPeer(context.Context, peer.ID) (peer.AddrInfo, error) //perm:read
NetPubsubScores(context.Context) ([]PubsubScore, error) //perm:read
NetAutoNatStatus(context.Context) (NatInfo, error) //perm:read
NetAgentVersion(ctx context.Context, p peer.ID) (string, error) //perm:read
NetPeerInfo(context.Context, peer.ID) (*ExtendedPeerInfo, error) //perm:read
// NetBandwidthStats returns statistics about the nodes total bandwidth
// usage and current rate across all peers and protocols.
NetBandwidthStats(ctx context.Context) (metrics.Stats, error) //perm:read
// NetBandwidthStatsByPeer returns statistics about the nodes bandwidth
// usage and current rate per peer
NetBandwidthStatsByPeer(ctx context.Context) (map[string]metrics.Stats, error) //perm:read
// NetBandwidthStatsByProtocol returns statistics about the nodes bandwidth
// usage and current rate per protocol
NetBandwidthStatsByProtocol(ctx context.Context) (map[protocol.ID]metrics.Stats, error) //perm:read
// ConnectionGater API
NetBlockAdd(ctx context.Context, acl NetBlockList) error //perm:admin
NetBlockRemove(ctx context.Context, acl NetBlockList) error //perm:admin
NetBlockList(ctx context.Context) (NetBlockList, error) //perm:read
NetProtectAdd(ctx context.Context, acl []peer.ID) error //perm:admin
NetProtectRemove(ctx context.Context, acl []peer.ID) error //perm:admin
NetProtectList(ctx context.Context) ([]peer.ID, error) //perm:read
// ResourceManager API
NetStat(ctx context.Context, scope string) (NetStat, error) //perm:read
NetLimit(ctx context.Context, scope string) (NetLimit, error) //perm:read
NetSetLimit(ctx context.Context, scope string, limit NetLimit) error //perm:admin
// ID returns peerID of libp2p node backing this API
ID(context.Context) (peer.ID, error) //perm:read
}
type NatInfo struct {
Reachability network.Reachability
PublicAddrs []string
}