Skip to content

Commit

Permalink
Refactor services (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
cofob authored Jul 26, 2024
1 parent e701b7a commit f144eb7
Show file tree
Hide file tree
Showing 17 changed files with 10,484 additions and 776 deletions.
50 changes: 45 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
[package]
name = "fastside"
description = "A smart redirecting gateway for various frontend services."
version = "0.1.0"
version = "0.2.0"
edition = "2021"

[dependencies]
actix-web = { version = "4.5.1", features = [
"macros",
"cookies",
], default-features = false } # web framework
askama = "0.12.1" # templating engine
reqwest = { version = "0.12.4", default-features = false, features = [
"rustls-tls",
"http2",
"socks",
] } # http client

clap = { version = "4.5.4", features = ["derive"] } # cli
Expand All @@ -29,6 +31,9 @@ futures = "0.3.30" # async
num_cpus = "1.16.0" # get number of cpus
rand = "0.8.5" # random
chrono = "0.4.38" # datetime
regex = "1.10.5" # regex
base64 = "0.22.1" # base64
urlencoding = "2.1.3" # url encoding

[profile.release]
overflow-checks = true
Expand Down
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ Contents

- [fastside](#fastside)
- [About](#about)
- [Features](#features)
- [Demo](#demo)
- [Mirrors](#mirrors)
- [How It Works](#how-it-works)
- [Why does this fork exist?](#why-does-this-fork-exist)
- [To Do](#to-do)

## About

Expand All @@ -23,6 +24,16 @@ available public instances for a particular service, while also helping to
distribute traffic more evenly across all instances and avoid performance
bottlenecks and rate-limiting.

## Features

- [x] Support for hidden networks (tor, i2p, etc).
- [x] Redirect behaviour can be configured. (for example - you can exclude cloudflare)
- [x] POST redirects.
- [x] Regex redirects via `/{url}` routes.
- [x] Anonymous and cached redirects via `/@cached/#{path}` routes.
- [x] History redirects via `/_/{path}` routes.
- [x] Fallback redirects.

## Demo

Fastside's links work with the following structure: `fastside.link/<service>/<path>`
Expand Down Expand Up @@ -50,6 +61,11 @@ For example:
<td>/watch?v=zLGDE2j_n5c</td>
<td><a href="https://fastside.link/_/invidious/watch?v=zLGDE2j_n5c">https://fastside.link/_/invidious/watch?v=zLGDE2j_n5c</a></td>
</tr>
<tr>
<td><a href="https://github.com/iv-org/invidious">Invidious</a></td>
<td>https://www.youtube.com/watch?v=zLGDE2j_n5c</td>
<td><a href="https://fastside.link/https://www.youtube.com/watch?v=zLGDE2j_n5c">https://fastside.link/https://www.youtube.com/watch?v=zLGDE2j_n5c</a></td>
</tr>
<tr>
<td><a href="https://github.com/httpjamesm/AnonymousOverflow">AnonymousOverflow</a></td>
<td>/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags</td>
Expand All @@ -60,8 +76,9 @@ For example:

<sup>Note: This table doesn't include all available services. For a complete list of supported frontends, see: https://fastside.link/</sup>

Additionally, Fastside includes a caching feature that makes redirects faster and anonymous:
`/@cached/<service>/#<path>`
## Mirrors

Fastside can be opened in [clearnet](https://fastside.link/), [clearnet cloudflare](https://cdn.fastside.link/), [tor](http://a7xvcthrhfcsox73brt5hgueapwosohmieg5wttvuuuz6mqur5s3rqyd.onion/), [i2p](http://fastside.i2p/) ([b32](http://i4autaipx7a4ro34cbwvni6bcph34eueocplwsxaqeeuyb6cavzq.b32.i2p)), [yggdrasil](http://ygg.fastside.link/) ([IPv6](http://[200:691d:578e:f10e:e935:f189:aab4:1d98]/)).

## How It Works

Expand All @@ -83,7 +100,3 @@ their server in the USA is 300 ms, and a redirect request takes about 1 second t
processing a redirect takes 700 ms, which is incredibly long for such a simple task. On the other hand, Fastside
processes requests in 200-300 ms (taking my internet into account). Additionally, the web server at fastside.link
supports http3, which saves us an additional 100-150 ms.

## To Do

- [ ] GeoDB integration
6 changes: 4 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

fastside = pkgs.stdenv.mkDerivation {
pname = "fastside";
version = "0.1.0";
version = "0.2.0";

src = self;

Expand Down Expand Up @@ -63,7 +63,9 @@
default = fastside;
fastside = fastside;
fastside-docker = fastside-docker;
services = ./services.json;
services = pkgs.runCommand "generate-services" {} ''
cat '${./services.json}' > $out
'';
};

devShells.default = pkgs.mkShell {
Expand Down
Loading

0 comments on commit f144eb7

Please sign in to comment.