From f7b1a7c1293d6ef6b4ae27a80aaa3c77bc9120c0 Mon Sep 17 00:00:00 2001 From: Linus Gasser Date: Fri, 30 Aug 2024 17:23:24 +0200 Subject: [PATCH] Adding web-proxy - Now it's possible for one node to ask another node to send out a proxy request - Added the feature to the frontend - Updated the frontend a bit --- CHANGELOG.md | 1 + WIP.md | 3 +- flbrowser/Cargo.toml | 2 + flbrowser/index.html | 95 ++++++++-- flbrowser/main.css | 11 ++ flbrowser/src/main.rs | 45 ++++- flmodules/src/gossip_events/events.rs | 2 +- flmodules/src/web_proxy/README.md | 6 + flmodules/src/web_proxy/broker.rs | 254 ++++++++++++++++++++++++++ flmodules/src/web_proxy/core.rs | 166 +++++++++++++++++ flmodules/src/web_proxy/messages.rs | 193 +++++++++++++++++++ flmodules/src/web_proxy/mod.rs | 8 + flmodules/src/web_proxy/response.rs | 151 +++++++++++++++ 13 files changed, 905 insertions(+), 32 deletions(-) create mode 100644 flmodules/src/web_proxy/README.md create mode 100644 flmodules/src/web_proxy/broker.rs create mode 100644 flmodules/src/web_proxy/core.rs create mode 100644 flmodules/src/web_proxy/messages.rs create mode 100644 flmodules/src/web_proxy/mod.rs create mode 100644 flmodules/src/web_proxy/response.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index 6654aa5f..06222124 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ Following https://keepachangelog.com/en/1.1.0/ and using - Create a template to fill out - License files - Devbox +- Create a proxy module that links to the html display ## [0.7.0] - 2022-08-01 diff --git a/WIP.md b/WIP.md index 3f2cf7f1..c2c38889 100644 --- a/WIP.md +++ b/WIP.md @@ -10,7 +10,6 @@ ## Features - Needed for semester project: - - Create a proxy module that links to the html display - Import library for html serving with callbacks for loading of elements - Easy simulation - w/o network @@ -19,13 +18,13 @@ ## Bugs +- flmodules/web_proxy has horrible error handling - too many `expect`s - flnet errors - perhaps not necessary to fix if matchbox works: - Find why the network stalls after some time - Doesn't work in EPFL network ## Cleanups / improvements -- use tokio::sync::watch to pass configuration from `Translate` to `Broker` - yaml files are stored as .toml - make sure old files can be read as .toml - save new files as .yaml diff --git a/flbrowser/Cargo.toml b/flbrowser/Cargo.toml index fdb3e760..1429c218 100644 --- a/flbrowser/Cargo.toml +++ b/flbrowser/Cargo.toml @@ -34,6 +34,8 @@ features = [ 'Document', 'Element', 'HtmlElement', + 'HtmlDivElement', + 'HtmlInputElement', 'HtmlTextAreaElement', 'Node', 'Window', diff --git a/flbrowser/index.html b/flbrowser/index.html index 72221628..fb6bbd8b 100644 --- a/flbrowser/index.html +++ b/flbrowser/index.html @@ -16,8 +16,16 @@

Starting up

-
-

This is a decentralized chatting app. Instead of having a central server that stores all +

+
+ +

Fledger

+

Welcome to the latest version of the Fledger Node. + Fledger is an experiment in a decentralized system running in your browser. + It's goal is to mix things like Veilid, + IPFS, and something like + Narhal. +

+

Try it out by clicking on the above tabs to join the Blackboard or the + WebProxy. +

+

Uniqueness of Fledger

+

Instead of having to install all of these things on your computer, handling all the + configuration and dependencies, you simply come here and participate in a decentralized + system. + This version of the system has the following applications: +

+
    +
  • Decentralized blackboard - write a message for everybody to see
  • +
  • Web proxy - route your web traffic through another node (not anonymous yet!)
  • +
+

Work In Progress

+

The fledger system is extensible with modules, and we think hard to implement the + following modules: +

+
    +
  • Mixing Network - in a semester project with the DEDIS lab at EPFL
  • +
  • Storage - IPFS-like decentralized storage where you get storage by sharing your + own harddisk storage +
  • +
+

These modules will allow to port applications like the following, and add new ones:

+
    +
  • LiveQuiz so that the storage is on fledger
  • +
  • Jemifier and store the lists on fledger
  • +
  • Anonymous surfing
  • +
+

+
+ +
+
+

This is a decentralized chatting app, implemented like a global blackboard. + Instead of having a central server that stores all messages, every visitor joining the system stores the last 20 messages. So even if the central server goes down or censors messages, the clients can still communicate.

-

You can find the code on github: ineiti/fledger


Your Message

@@ -51,27 +102,28 @@

Statistics


Messages

+
+
+
+

WebProxy

+
+ + +
+
Enter a URL and click on "Proxy Request". + The request will be proxied through one of the nodes online. +
+
+

The goal of Fledger is to have a full node running in the web browser. Instead of having to invest in big hardware, fledger will be light enough that you can participate using a browser. You will mine Mana can be used to run smart contracts, store data, or use the re-encryption service.

-

The state of the project is

-
    -
  • Networking
  • -
      -
    • Done: learning Rust and making WebRTC work reliably
    • -
    • Done: setting up of TURN server
    • -
    • Done: rewrite of networking backend without reason
    • -
    • Done: simple gossiping of content
    • -
    • Done 2022-10: create flnet crate with webrtc in libc and wasm
    • -
    -
  • Coming up: decentralized sharing with incentives
  • -
  • Coming up: setting up chains for sharing tracking
  • -

For more information, see the documentation: Fledger - the blockchain that could

@@ -89,12 +141,15 @@

Messages

+
-
+
+ GitHub - @ineiti@ioc.exchange +
- + \ No newline at end of file diff --git a/flbrowser/main.css b/flbrowser/main.css index 64c5f316..d962c2c3 100644 --- a/flbrowser/main.css +++ b/flbrowser/main.css @@ -80,3 +80,14 @@ ul.no-bullets { .wrap { white-space: pre-wrap; } + +#proxy_div { + margin: 1em; + padding: 1em; + border: 1pt solid #888; + background-color: #444; +} + +#proxy_url { + width: 80%; +} \ No newline at end of file diff --git a/flbrowser/src/main.rs b/flbrowser/src/main.rs index 3bdd3149..f498c812 100644 --- a/flbrowser/src/main.rs +++ b/flbrowser/src/main.rs @@ -18,7 +18,7 @@ use wasm_bindgen::{ prelude::{wasm_bindgen, Closure}, JsCast, JsValue, }; -use web_sys::{window, Document, Event, HtmlTextAreaElement}; +use web_sys::{window, Document, Event, HtmlDivElement, HtmlInputElement, HtmlTextAreaElement}; use flarch::{ data_storage::DataStorageLocal, @@ -37,6 +37,7 @@ const URL: &str = "ws://localhost:8765"; enum Button { SendMsg, DownloadData, + WebProxy, } #[wasm_bindgen(module = "/src/main.js")] @@ -55,15 +56,14 @@ fn main() { // Create a listening channel that fires whenever the user clicks on the `send_msg` button let (tx, mut rx) = tokio::sync::mpsc::unbounded_channel::