Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/add typedefs peerstore book template 2 #831

Closed
wants to merge 57 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
2548885
feat: auto relay (#723)
vasco-santos Sep 16, 2020
8d75093
chore: auto relay multiaddr update push
vasco-santos Sep 10, 2020
971655f
chore: _isStarted is false when stop starts
vasco-santos Sep 23, 2020
ee8ee5b
chore: use listening events to create self peer record on updates
vasco-santos Sep 23, 2020
87d20ac
chore: create signed peer record on new listen addresses in transport…
vasco-santos Sep 23, 2020
abba305
chore: add identify test for multiaddr change
vasco-santos Sep 24, 2020
05e6472
chore: address review
vasco-santos Sep 24, 2020
2530b83
chore: lint issue fixed 0.30
vasco-santos Oct 7, 2020
e6b0134
feat: auto relay network query for new relays
vasco-santos Sep 11, 2020
3d2181f
chore: address review
vasco-santos Sep 23, 2020
29e30c2
chore: add configuration docs for auto relay and hop service
vasco-santos Sep 23, 2020
2746b4b
chore: apply suggestions from code review
vasco-santos Oct 5, 2020
722cacd
chore: lint issues fixed
vasco-santos Oct 7, 2020
3bd1768
chore: sort relay addresses to listen for public first
vasco-santos Oct 8, 2020
558bcf9
chore: improve logging for auto relay active listen
vasco-santos Oct 8, 2020
8456d0e
chore: store self protocols in protobook (#760)
vasco-santos Oct 27, 2020
0c551d2
feat: custom announce filter
vasco-santos Oct 15, 2020
0d1a34b
chore: remove noAnnounce from address manager
vasco-santos Oct 27, 2020
10d449a
chore: update address manager readme
vasco-santos Nov 3, 2020
e1ffee1
fix: remove test/dialing/utils extra file
vasco-santos Nov 10, 2020
81c5c43
test: custom announce filter
vasco-santos Oct 15, 2020
bd214d5
chore: update pubsub (#801)
vasco-santos Nov 13, 2020
ad6187d
feat: custom dialer addr sorter (#792)
vasco-santos Nov 20, 2020
b5e38de
docs: auto relay example (#795)
vasco-santos Nov 20, 2020
c6fd23a
chore: update websockets (#806)
vasco-santos Nov 24, 2020
7c3f7e0
feat: discover and connect to closest peers (#798)
vasco-santos Nov 25, 2020
dbc2653
chore: use set-delayed-interval module on circuit (#809)
vasco-santos Nov 26, 2020
dfcce96
docs: migration 0.29 to 0.30 (#808)
vasco-santos Nov 26, 2020
26c40c8
chore: add typedefs
vasco-santos Nov 16, 2020
7e05c4a
chore: address review
vasco-santos Nov 25, 2020
28b9f85
chore: add types checker script and more fixes on the jsdocs
vasco-santos Nov 26, 2020
4b309ad
chore: use new libp2p interface
vasco-santos Dec 1, 2020
149c19a
chore: minor fixes and github ci
vasco-santos Dec 2, 2020
d3d6b35
chore: fix remaining ts ignores
vasco-santos Dec 2, 2020
89fd524
chore: reset cache ci...
vasco-santos Dec 2, 2020
2109ef0
chore: remove interfaces dep for ci cache
vasco-santos Dec 2, 2020
32dd055
chore: reset cache ci...
vasco-santos Dec 2, 2020
a5f5160
chore: update record, transport and stream muxer per latest interface…
vasco-santos Dec 3, 2020
77a0257
chore: add interop and examples in github actions
vasco-santos Dec 3, 2020
e519a6c
chore: minor changes from lodestar testing
vasco-santos Dec 3, 2020
bb0cbc1
chore: add typedefs peerstore book template
vasco-santos Dec 3, 2020
55910c8
chore: minor changes from lodestar testing
vasco-santos Dec 3, 2020
8cc03ca
chore: update pubsub example by disabled emit self (#823)
vasco-santos Dec 4, 2020
1992609
chore: add libp2p modules typedef
vasco-santos Dec 8, 2020
9b863bd
chore: apply suggestions from code review
vasco-santos Dec 9, 2020
b221e97
chore: address rest of review
vasco-santos Dec 9, 2020
a044b5d
chore: auto relay configuration example with noise (#828)
vasco-santos Dec 9, 2020
d1caeb3
Merge remote-tracking branch 'upstream/chore/add-typedefs' into chore…
Gozala Dec 10, 2020
ce07544
chore: use aegir with ts 4.1.x
Gozala Dec 10, 2020
7706e39
fix: remaining type errors
Gozala Dec 10, 2020
9966c6c
chore: apply suggestions from code review
vasco-santos Dec 10, 2020
aa98bc2
chore: address other review comments
vasco-santos Dec 10, 2020
c4bb3fa
chore: merge typedefs newest updates
vasco-santos Dec 10, 2020
e014fee
chore: fix lint
vasco-santos Dec 10, 2020
cba25c8
chore: remove ts ignore from add stream
vasco-santos Dec 10, 2020
a279926
chore: add typedefs (#802)
vasco-santos Dec 10, 2020
2e7f49e
chore: merge 0.30
vasco-santos Dec 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: address other review comments
vasco-santos committed Dec 10, 2020
commit aa98bc2f0e03b6e1c03815e78be1f709a9fda6a6
2 changes: 1 addition & 1 deletion src/circuit/circuit/stop.js
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ const { validateAddrs } = require('./utils')
* @typedef {import('libp2p-interfaces/src/connection').Connection} Connection
* @typedef {import('libp2p-interfaces/src/stream-muxer/types').MuxedStream} MuxedStream
* @typedef {import('../../types').CircuitRequest} CircuitRequest
* @typedef {import('./stream-handler')<Request>} StreamHandlerT
* @typedef {import('./stream-handler')<CircuitRequest>} StreamHandlerT
*/

/**
4 changes: 3 additions & 1 deletion src/circuit/transport.js
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ const transportSymbol = Symbol.for('@libp2p/js-libp2p-circuit/circuit')
* @typedef {import('multiaddr')} Multiaddr
* @typedef {import('libp2p-interfaces/src/connection').Connection} Connection
* @typedef {import('libp2p-interfaces/src/stream-muxer/types').MuxedStream} MuxedStream
* @typedef {import('../types').CircuitRequest} CircuitRequest
*/

class Circuit {
@@ -53,6 +54,7 @@ class Circuit {
* @param {MuxedStream} props.stream
*/
async _onProtocol ({ connection, stream }) {
/** @type {import('./circuit/stream-handler')<CircuitRequest>} */
const streamHandler = new StreamHandler({ stream })
const request = await streamHandler.read()

@@ -101,7 +103,7 @@ class Circuit {
remoteAddr,
localAddr
})
const type = request.Type === CircuitPB.Type.HOP ? 'relay' : 'inbound'
const type = request.type === CircuitPB.Type.HOP ? 'relay' : 'inbound'
log('new %s connection %s', type, maConn.remoteAddr)

const conn = await this._upgrader.upgradeInbound(maConn)
3 changes: 0 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -95,9 +95,6 @@ class Libp2p extends EventEmitter {
super()
// validateConfig will ensure the config is correct,
// and add default values where appropriate
/**
* @private
*/
this._options = validateConfig(_options)

/** @type {PeerId} */
8 changes: 6 additions & 2 deletions src/record/peer-record/index.js
Original file line number Diff line number Diff line change
@@ -66,10 +66,14 @@ class PeerRecord {
/**
* Returns true if `this` record equals the `other`.
*
* @param {PeerRecord} other
* @returns {other is Record}
* @param {unknown} other
* @returns {boolean}
*/
equals (other) {
if (!(other instanceof PeerRecord)) {
return false
}

// Validate PeerId
if (!this.peerId.equals(other.peerId)) {
return false