logos-delivery-js/packages/interfaces/src/connection_manager.ts
Danish Arora 24c24cc27d
feat!: ConnectionManager and KeepAliveManager (#1135)
* initialises ConnectionManager and KeepAliveManager
ports from previous PR and makes necessary improvements and reductions

* address: comments

* map a ConnectionManager instance with a WakuNode

* abstract event listeners logic

* minor fix

* minor cleaning

* instantiate KeepAliveManager instead of extending

* fix build and enable all tests

* fix CI

* address review

* refine event handlers
- only removes the previously attached callback from
the event handlers while shutting down service
- removes the requirement of passing around
`keepAliveOptions` and `relay` inside of
`ConnectionManager`

* add verbosity to interface

* make `dialPeer()` more readable

* use set to push tags to avoid duplicates

* fix: merge build

* remove: logging function

* rename startService and stopService

* remove: future TODO

added that as part of future refactor

* use the new libp2p api

* initialise options in constructor//fix TS error

* remove stale export

* address principal review

* reset test timeout to master
2023-02-20 15:30:59 +05:30

18 lines
574 B
TypeScript

export enum Tags {
BOOTSTRAP = "bootstrap",
PEER_EXCHANGE = "peer-exchange",
}
export interface ConnectionManagerOptions {
/**
* Number of attempts before a peer is considered non-dialable
* This is used to not spam a peer with dial attempts when it is not dialable
*/
maxDialAttemptsForPeer: number;
/**
* Max number of bootstrap peers allowed to be connected to, initially
* This is used to increase intention of dialing non-bootstrap peers, found using other discovery mechanisms (like Peer Exchange)
*/
maxBootstrapPeersAllowed: number;
}