This release introduces Decaying Tags in the Connection Manager interfaces. A decaying tag is one whose value automatically decays over time.
The actual application of the decay behaviour is encapsulated in a user-provided decaying function (DecayFn). The function is called on every tick (determined by the tag's Interval property), and returns either the new value of the tag, or whether it should be erased altogether.
We do not set values directly on a decaying tag. Rather, we "bump" decaying tags by a delta. Doing so calls the BumpFn with the old value and the delta, to determine the new value.
Such a pluggable design affords a great deal of flexibility and versatility. Behaviours that are straightforward to implement include:
Decay a tag by -1, or by half its current value, on every tick.
Every time a value is bumped, sum it to its current value.
Exponentially boost a score with every bump.
Sum the incoming score, but keep it within min, max bounds.
To use Decaying Tags, check if the Connection Manager supports them first via the SupportsDecay function.
This release adds interfaces for Connection Gating: middleware components that intercept connections at different stages and decide whether to ALLOW or BLOCK the connection. In contrast to Connection Managers, Connection Gaters are actively consulted throughout the dial/listen pipeline.
Connection Gaters can intercept connections at these stages:
InterceptPeerDial is called on an imminent outbound peer dial request, prior to the addresses of that peer being available/resolved. Blocking connections at this stage is typical for blacklisting scenarios.
InterceptAddrDial is called on an imminent outbound dial to a peer on a particular address. Blocking connections at this stage is typical for address filtering.
InterceptAccept is called as soon as a transport listener receives an inbound connection request, before any upgrade takes place. Transports who accept already secure and/or multiplexed connections (e.g. possibly QUIC) MUST call this method regardless, for correctness/consistency.
InterceptSecured is called for both inbound and outbound connections, after a security handshake has taken place and we've authenticated the peer.
InterceptUpgraded is called for inbound and outbound connections, after libp2p has finished upgrading the connection entirely to a secure, multiplexed channel.
Minor changes
Added a FirstSupportedProtocol API to the Protobook interface which returns the first protocol a peer supports from among the given interfaces.
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme
Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
Bumps github.com/libp2p/go-libp2p-core from 0.5.3 to 0.5.5.
Release notes
Sourced from github.com/libp2p/go-libp2p-core's releases.
Commits
e74305c
minor godoc fixes.65c8515
minor godoc fixes.9d35da1
implement Stringer for network.{Direction,Connectedness,Reachability}. (#150)e3a456b
build(deps): bump github.com/libp2p/go-openssl from 0.0.4 to 0.0.5 (#149)e5edab1
connmgr: introduce abstractions and functions for decaying tags. (#104)1c39960
Merge pull request #148 from libp2p/feat/supports-alloc909c774
add connection gating interfaces and types. (#139)dabf5bb
changes as per review98b95a4
non alloc version43dfa5f
check if peer supports a protocol without allocationDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language - `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com): - Update frequency (including time of day and day of week) - Pull request limits (per update run and/or open at any time) - Out-of-range updates (receive only lockfile updates, if desired) - Security updates (receive only security updates, if desired)