-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add sessions to trustless gateways (#459)
Implements blockstore sessions for trustless gateways. - Queries the Helia routing for block providers - Creates a set of trustless gateways from routing results - Uses only these gateways to fetch session blocks --------- Co-authored-by: Russell Dempsey <[email protected]>
- Loading branch information
1 parent
5cf216b
commit 6ddefb0
Showing
6 changed files
with
248 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import cors from 'cors' | ||
import polka from 'polka' | ||
|
||
/** @type {import('aegir').PartialOptions} */ | ||
const options = { | ||
test: { | ||
async before (options) { | ||
const server = polka({ | ||
port: 0, | ||
host: '127.0.0.1' | ||
}) | ||
server.use(cors()) | ||
server.all('/ipfs/bafkreiefnkxuhnq3536qo2i2w3tazvifek4mbbzb6zlq3ouhprjce5c3aq', (req, res) => { | ||
res.writeHead(200, { | ||
'content-type': 'application/octet-stream' | ||
}) | ||
res.end(Uint8Array.from([0, 1, 2, 0])) | ||
}) | ||
|
||
await server.listen() | ||
const { port } = server.server.address() | ||
|
||
return { | ||
server, | ||
env: { | ||
TRUSTLESS_GATEWAY: `http://127.0.0.1:${port}` | ||
} | ||
} | ||
}, | ||
async after (options, before) { | ||
await before.server.server.close() | ||
} | ||
} | ||
} | ||
|
||
export default options |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters