Skip to content

Commit

Permalink
Add gateway to proxy requests via http service
Browse files Browse the repository at this point in the history
  • Loading branch information
Ma233 committed Jun 6, 2024
1 parent 72a1cc6 commit deeeca1
Show file tree
Hide file tree
Showing 6 changed files with 376 additions and 23 deletions.
119 changes: 100 additions & 19 deletions Cargo.lock

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

7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,20 @@ version = "0.1.0"
edition = "2021"

[dependencies]
base64 = "0.22.1"
bytes = "1.6.0"
clap = "4.5.4"
futures = "0.3.30"
hex = "0.4.3"
http = "1.1.0"
http-body-util = "0.1.1"
httparse = "1.8.0"
hyper = { version = "1.3.1", features = ["server", "http1"] }
hyper-util = { version = "0.1.5", features = ["tokio"] }
litep2p = "0.5.0"
# Do not upgrade multiaddr, see: https://github.com/paritytech/litep2p/pull/91
multiaddr = "0.17.1"
percent-encoding = "2.3.1"
prost = "0.12.4"
thiserror = "1.0.60"
tokio = { version = "1.37.0", features = ["rt-multi-thread"] }
Expand Down
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# dephy-pproxy

dephy-pproxy is a http proxy over litep2p.

## Usage
Run the server:
```shell
cargo run -- --proxy-addr 127.0.0.1:8000
```

Run the client:
```shell
cargo run -- --server-addr 127.0.0.1:6666 --commander-server-addr 127.0.0.1:7777 --proxy-gateway-addr 127.0.0.1:8080
```

Add server peer to client:
```shell
grpcurl -plaintext -import-path ./proto -proto command_v1.proto -d '{"address": "<The litep2p multiaddr>"}' '127.0.0.1:7777' command.v1.CommandService/AddPeer
```

Access server via the gateway address:
```shell
curl -H 'peerid: <peerid provided by AddPeer>' 127.0.0.1:8080
```
Loading

0 comments on commit deeeca1

Please sign in to comment.