-
Notifications
You must be signed in to change notification settings - Fork 106
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
feat: add sessions to trustless gateways #459
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
546bf66
feat: add block session support to @helia/interface
achingbrain 5836dcd
chore: pr comments
achingbrain 3d9cb49
chore: linting
achingbrain 39b6f7a
chore: simplify options
achingbrain d1228b9
chore: createSession is not optional on blocks
achingbrain 32713ab
chore: update utils
achingbrain 0c28d66
chore: create block brokers last to access components
achingbrain d0610c9
chore: do not dedupe at the routing level as different impls return d…
achingbrain 9aeded1
chore: add defaults to interface
achingbrain 8e6051a
chore: remove unused dep
achingbrain ca1c458
chore: update constants
achingbrain d7d6334
chore: apply suggestions from code review
achingbrain 8c42ec5
Merge remote-tracking branch 'origin/main' into feat/add-sessions-to-…
achingbrain 8997d41
feat: add sessions to trustless gateways
achingbrain 60365d2
chore: close server
achingbrain ac06ff6
chore: filter by http address
achingbrain 263bc1c
Merge remote-tracking branch 'origin/main' into feat/add-trustless-ga…
achingbrain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worried about defaulting to asking gateways to only return content they have. will read more in the PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to stop them doing what gateways do, e.g. fetch content on your behalf. Otherwise it defeats the purpose of having a session.