{"id":27185081,"url":"https://github.com/threefoldtech/webgw","last_synced_at":"2025-07-28T14:06:28.109Z","repository":{"id":94355495,"uuid":"585486451","full_name":"threefoldtech/webgw","owner":"threefoldtech","description":"ThreeFold Grid network utilities","archived":false,"fork":false,"pushed_at":"2023-10-12T03:41:29.000Z","size":224,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-06-05T02:06:56.530Z","etag":null,"topics":["networking","proxy","threefold"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/threefoldtech.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-05T09:44:46.000Z","updated_at":"2023-02-25T00:33:46.000Z","dependencies_parsed_at":"2025-04-09T17:10:32.798Z","dependency_job_id":"6a6b2dd6-b1c5-4ae1-a02a-7a3fa87f8001","html_url":"https://github.com/threefoldtech/webgw","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/threefoldtech/webgw","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/threefoldtech%2Fwebgw","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/threefoldtech%2Fwebgw/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/threefoldtech%2Fwebgw/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/threefoldtech%2Fwebgw/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/threefoldtech","download_url":"https://codeload.github.com/threefoldtech/webgw/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/threefoldtech%2Fwebgw/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267527835,"owners_count":24102019,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["networking","proxy","threefold"],"created_at":"2025-04-09T17:10:29.952Z","updated_at":"2025-07-28T14:06:28.082Z","avatar_url":"https://github.com/threefoldtech.png","language":"Rust","readme":"# Webgw\n\nWeb gateway is intended to provide networking related components for the\nThreeFold Grid. Currently a transparent layer 4 proxy is implemented,\nwhich uses HTTP Host header and TLS SNI extension sniffing to identify\nthe intended target, and proxy the connection there.\n\nFor in depth documentation, please check [the documentation\ndirectory](./docs/). Alternatively, if you just want to get up and\nrunning, you can continue with the quick start below.\n\n## Getting started\n\nYou can either download the latest release of the client and server, or\nbuild them from source.\n\n### Building from source\n\n#### Prerequisites\n\nIn order to build from source, you will need to have the `rust compiler`\ninstalled. This project targets the latest stable version of rust. Older\nversions might work, but are not officially supported.\n\n#### Building\n\nFirst clone this repository locally.\n\n```sh\ngit clone https://github.com/threefoldtech/webgw\n```\n\nThen, standard rust compilation instructions apply\n\n```sh\ncd webgw\ncargo build\n```\n\nThis will create a debug build of the binaries in the `./target/debug/`\ndirectory. As with all rust projects, you can add the `--release` flag\nto create an optimized build (at the cost of increased compile times),\nand add the `--target xxx` flag to cross-compile for different\narchitectures and/or operating systems.\n\n#### Example setup\n\nWith a `client` and `server` binary available, you can run the project\nyourself. You will also need a configuration file for the client in TOML\nformat, [an example one is provided](./config.toml). The following\ninstruction will work with this example config (and assume you have\n`server` and `client` binaries in the current directory). For an\nin-depth explanation of the config file, you can check [the associated\ndocumentation](./docs/webgw_client_config.md)\n\n1. Start the server. Since the server binds port 80 and 443, it will\n   require root privileges. If you do not want to do this, you can first\n   add the `CAP_NET_BIND_SERVICE` capability to the binary as such:\n\n   ```sh\n   sudo setcap CAP_NET_BIND_SERVICE=+eip ./server\n   ```\n\n   Start the server (after adding capabilities, or as root user), with\n   debug logging enabled\n\n   ```sh\n   ./server -d\n   ```\n\n1. Register the host (`www.example.com` in this case) on the server via\n   the HTTP API. In our example config, you can see that the secret is\n   actually 32 '0' characters (if you decode the hex value). When\n   hashed with SHA256, this turns into the hex string\n   `\"84e0c0eafaa95a34c293f278ac52e45ce537bab5e752a00e6959a13ae103b65a\"`.\n   If curl is available, you can add the host with the following command\n   line call\n\n   ```sh\n   curl -H 'content-type: application/json' -XPOST -d '{\"host\":\"www.example.com\", \"hexSecretHash\":\"84e0c0eafaa95a34c293f278ac52e45ce537bab5e752a00e6959a13ae103b65a\"}' localhost:8080/api/v1/proxy\n   ```\n\n1. Start a server which will act as the backend service. You can use\n   anything here, but for this example we will use the python http\n   file server on port 10080. You can use a different port, but this\n   will require a change in the example config.\n\n   ```sh\n   python3 -m http.server 10080\n   ```\n\n1. Spawn the client, which will connect to the server, and initiate a\n   new proxy connection when the server identifies a new connection for\n   the host (`www.example.com`)\n\n   ```sh\n   ./client -c config.toml\n   ```\n\nYou are now able to connect to the server on port 80, and you'll see the\noutput of your chosen backend. Additionally, if your server listens for\nTLS connections, you can also use those by connecting to port 443. The\nexample config assumes the backend listens for TLS on port 10443, though\nthis can be changed as desired. An example of using curl to verify the\nsetup\n\n```sh\ncurl -H 'Host: www.example.com' localhost:80\n```\n\nIf you prefer to use your browser, you can modify your host file\n(`/etc/hosts` on linux), and add an entry to point `www.example.com` to\n`::1`. You can then use your browser and navigate to `www.example.com`\nto interact with the backend.\n\n### Developing\n\nShould you wish to modify or extend the current codebase, you can create\na fork, where your changes are implemented, and then create a Pull\nRequest to merge the changes into the project. All work should have a\ntracking issue in this repo, where an issue / feature request is\ndescribed, so consensus can be reached on how the solution should be\nimplemented first. The eventual Pull Request should link to this\ntracking issue.\n\n#### Code style\n\nThis project aims to be implemented in idiomatic rust. Next to this,\n`unsafe` code block should be avoided. If this is not possible, the\n`unsafe` block must have a `SAFETY` comment on it, which explains why\nthe `unsafe` code is needed, and why it is valid.\n\nAll code must be formatted (`cargo fmt`). Additionally, code must pass\n`clippy` validation.\n\n```sh\ncargo fmt\ncargo clippy\n```\n\nFormatting can generally be done by your editor when saving a file.\nAdditionally, most lsp plugins can be configured to also run clippy for\nadditional lints.\n\nNote that if the clippy command fails because it is not installed, you\ncan do so by running\n\n```sh\nrustup component add clippy\n```\n\n#### Running tests\n\nRunning tests is done in the traditional rust way\n\n```sh\ncargo test\n```\n\nAdditionally, you can use [miri](https://github.com/rust-lang/miri) to\ncheck for unsoundness. This is generally not needed, but is useful to do\nshould you have no other option than to write an `unsafe` code section.\n\n```sh\nMIRIFLAGS=\"-Zmiri-disable-isolation\" cargo +nightly miri test\n```\n\n## License\n\nThis project is licensed under [the Apache 2.0 license](./LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthreefoldtech%2Fwebgw","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthreefoldtech%2Fwebgw","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthreefoldtech%2Fwebgw/lists"}