-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add common docker handler and common mirrors
add `follow_redirects` options add `out` params for `aria2.addUri`
- Loading branch information
Anonymous
committed
Jun 13, 2024
1 parent
d06c749
commit 833a31a
Showing
10 changed files
with
191 additions
and
172 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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from starlette.requests import Request | ||
|
||
from mirrorsrun.proxy.direct import direct_proxy | ||
from starlette.responses import Response | ||
|
||
|
||
async def common(request: Request): | ||
path = request.url.path | ||
if path == "/": | ||
return | ||
if path.startswith("/alpine"): | ||
return await direct_proxy(request, "https://dl-cdn.alpinelinux.org" + path) | ||
if path.startswith("/ubuntu/"): | ||
return await direct_proxy(request, "http://archive.ubuntu.com" + path) | ||
if path.startswith("/ubuntu-ports/"): | ||
return await direct_proxy(request, "http://ports.ubuntu.com" + path) | ||
|
||
return Response("Not Found", status_code=404) |
Oops, something went wrong.