package relay
Import Path
github.com/libp2p/go-libp2p/p2p/protocol/circuitv2/relay (on go.dev)
Dependency Relation
imports 23 packages, and imported by 4 packages
Package-Level Type Names (total 7)
ACLFilter is an Access Control mechanism for relayed connect.
AllowConnect returns true if a source peer, with a given multiaddr is allowed to connect
to a destination peer.
AllowReserve returns true if a reservation from a peer with the given peer ID and multiaddr
is allowed.
func WithACL(acl ACLFilter) Option
MetricsTracer is the interface for tracking metrics for relay service
BytesTransferred tracks the total bytes transferred by the relay service
ConnectionClosed tracks metrics on closing a relay connection
ConnectionOpened tracks metrics on opening a relay connection
ConnectionRequestHandled tracks metrics on handling a relay connection request
RelayStatus tracks whether the service is currently active
ReservationAllowed tracks metrics on opening or renewing a relay reservation
ReservationRequestClosed tracks metrics on closing a relay reservation
ReservationRequestHandled tracks metrics on handling a relay reservation request
func NewMetricsTracer(opts ...MetricsTracerOption) MetricsTracer
func WithMetricsTracer(mt MetricsTracer) Option
func WithRegisterer(reg prometheus.Registerer) MetricsTracerOption
func NewMetricsTracer(opts ...MetricsTracerOption) MetricsTracer
func WithACL(acl ACLFilter) Option
func WithInfiniteLimits() Option
func WithLimit(limit *RelayLimit) Option
func WithMetricsTracer(mt MetricsTracer) Option
func WithResources(rc Resources) Option
func New(h host.Host, opts ...Option) (*Relay, error)
func github.com/libp2p/go-libp2p/p2p/host/relaysvc.NewRelayManager(host host.Host, opts ...Option) *relaysvc.RelayManager
func github.com/libp2p/go-libp2p.EnableRelayService(opts ...Option) libp2p.Option
Relay is the (limited) relay service object.
(*Relay) Close() error
*Relay : github.com/prometheus/common/expfmt.Closer
*Relay : io.Closer
func New(h host.Host, opts ...Option) (*Relay, error)
RelayLimit are the per relayed connection resource limits.
Data is the limit of data relayed (on each direction) before resetting the connection.
Defaults to 128KB
Duration is the time limit before resetting a relayed connection; defaults to 2min.
func DefaultLimit() *RelayLimit
func WithLimit(limit *RelayLimit) Option
Resources are the resource limits associated with the relay service.
BufferSize is the size of the relayed connection buffers; defaults to 2048.
Limit is the (optional) relayed connection limits.
MaxCircuits is the maximum number of open relay connections for each peer; defaults to 16.
MaxReservations is the maximum number of active relay slots; defaults to 128.
MaxReservationsPerASN is the maximum number of reservations origination from the same
ASN; default is 32
MaxReservationsPerIP is the maximum number of reservations originating from the same
IP address; default is 8.
MaxReservationsPerPeer is the maximum number of reservations originating from the same
peer; default is 4.
Deprecated: We only need 1 reservation per peer.
ReservationTTL is the duration of a new (or refreshed reservation).
Defaults to 1hr.
func DefaultResources() Resources
func WithResources(rc Resources) Option
Package-Level Functions (total 10)
DefaultLimit returns a RelayLimit object with the defaults filled in.
DefaultResources returns a Resources object with the default filled in.
New constructs a new limited relay that can provide relay services in the given host.
func NewMetricsTracer(opts ...MetricsTracerOption) MetricsTracer
WithACL is a Relay option that supplies an ACLFilter for access control.
WithInfiniteLimits is a Relay option that disables limits.
WithLimit is a Relay option that sets only the relayed connection limits for the relay.
WithMetricsTracer is a Relay option that supplies a MetricsTracer for metrics
WithResources is a Relay option that sets specific relay resources for the relay.
Package-Level Constants (total 5)
const ConnectTimeout time.Duration = 30000000000 const HandshakeTimeout time.Duration = 60000000000 const ReservationTagWeight = 10 const ServiceName = "libp2p.relay/v2" const StreamTimeout time.Duration = 60000000000![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |