-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Http Get support for NFT feature (#22)
* impl PayloadData which has JsonRpcPayload and GetUrlPayload; provide general generate_payload_from_req func; doc comms; add url crate * remove Unnecessary trailing semicolon * use get_proxy_route_by_inbound func in http_handler, add test_parse_get_url_payload * rename GetUrl to HttpGet and GetUrlPayload to HttpGetPayload, some more doc comms * provide PayloadData type in proxy and validation_middleware funcs * impl proxy_http_get * docker-compose.yml for local tests and app json config * impl modify_request_uri func * use modify_request_uri func in proxy_http_get * remove `url` dependency, as for modify_request_uri functionality Uri type is enough * return Url type in HttpGetPayload. we need it for Deserialize, Serialize, and for general impl path in req uri have to represent only inbound_route * update note in modify_request_uri * update log name in macro_rules! log_format * provide error message in logs * remove header::CONTENT_LENGTH from http get request * simplify upsert_address_rate_in_pipe func, impl validation_middleware_http_get, have general validation_middleware func which handle all PayloadData types * rename proxy_eth to proxy_json_rpc * add get_req: bool param into parse_payload function * provide optional rate_limiter field in ProxyRoute, return NOT_ACCEPTABLE error if rate exceed for HTTP GET request * review: remove conf_docker_test.json and use .conf_test instead * review: move quicknode and moralis logic into separate crates, pin redis:7.2.4-alpine3.19 version. fix: Execute the pipeline once after setting all commands and make upsert_address_rate_in_pipe not async, as it just mutates Pipeline. * remove #[allow(dead_code)] in ProofOfFundingError * review: update doc comments and fields * readme: provide Docker Compose commands and update the configuration file description * remove empty lines between some modules in main.rs * add #[allow(dead_code)] annotation * impl parse_header_payload func * impl remove_unnecessary_headers func to avoid some code duplication * review: rename remove_unnecessary_headers to remove_hop_by_hop_headers * review: update docker section in readme * review: update Middleware description in readme * update GET req handling for Moralis * use req.uri().path() to find ProxyRote in websocket. Note: in the current stage only quicknode feature supports both websocket and http. * refactor quicknode: move SignedMessage to Header * review: remove note about inbound_route in test * review: update docs, rename parse functions, modify_request_uri non async * state unit types explicitly to adapt to new never type fallback * impl `get_proxy_route_extracting_uri_inbound` func and `test_get_proxy_route_by_uri_inbound` test, update modify_request_uri logic * review: avoid multiple iterations in get proxy with Uri functionality, move delete inbound from Uri to modify_request_uri --------- Co-authored-by: Onur Özkan <[email protected]>
- Loading branch information
1 parent
73738f0
commit 547b493
Showing
21 changed files
with
1,386 additions
and
563 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,74 @@ | ||
{ | ||
"port": 5000, | ||
"redis_connection_string": "dummy-value", | ||
"pubkey_path": "dummy-value", | ||
"privkey_path": "dummy-value", | ||
"token_expiration_time": 300, | ||
"proxy_routes": [ | ||
{ | ||
"inbound_route": "/test", | ||
"outbound_route": "https://komodoplatform.com", | ||
"authorized": false, | ||
"allowed_methods": [] | ||
}, | ||
{ | ||
"inbound_route": "/test-2", | ||
"outbound_route": "https://atomicdex.io", | ||
"authorized": false, | ||
"allowed_methods": [] | ||
} | ||
], | ||
"rate_limiter": { | ||
"rp_1_min": 555, | ||
"rp_5_min": 555, | ||
"rp_15_min": 555, | ||
"rp_30_min": 555, | ||
"rp_60_min": 555 | ||
} | ||
"port": 6150, | ||
"redis_connection_string": "redis://redis:6379", | ||
"pubkey_path": "/usr/src/komodo-defi-proxy/assets/.pubkey_test", | ||
"privkey_path": "/usr/src/komodo-defi-proxy/assets/.privkey_test", | ||
"token_expiration_time": 300, | ||
"proxy_routes": [ | ||
{ | ||
"inbound_route": "/test", | ||
"outbound_route": "https://komodoplatform.com", | ||
"proxy_type": "quicknode", | ||
"authorized": false, | ||
"allowed_rpc_methods": [], | ||
"rate_limiter": null | ||
}, | ||
{ | ||
"inbound_route": "/test-2", | ||
"outbound_route": "https://atomicdex.io", | ||
"proxy_type": "quicknode", | ||
"authorized": false, | ||
"allowed_rpc_methods": [], | ||
"rate_limiter": null | ||
}, | ||
{ | ||
"inbound_route": "/nft-test", | ||
"outbound_route": "https://nft.proxy", | ||
"proxy_type": "moralis", | ||
"authorized": false, | ||
"allowed_rpc_methods": [], | ||
"rate_limiter": { | ||
"rp_1_min": 60, | ||
"rp_5_min": 200, | ||
"rp_15_min": 700, | ||
"rp_30_min": 1000, | ||
"rp_60_min": 2000 | ||
} | ||
}, | ||
{ | ||
"inbound_route": "/nft-test/special", | ||
"outbound_route": "https://nft.special", | ||
"proxy_type": "moralis", | ||
"authorized": false, | ||
"allowed_rpc_methods": [], | ||
"rate_limiter": { | ||
"rp_1_min": 60, | ||
"rp_5_min": 200, | ||
"rp_15_min": 700, | ||
"rp_30_min": 1000, | ||
"rp_60_min": 2000 | ||
} | ||
}, | ||
{ | ||
"inbound_route": "/", | ||
"outbound_route": "https://adex.io", | ||
"proxy_type": "moralis", | ||
"authorized": false, | ||
"allowed_rpc_methods": [], | ||
"rate_limiter": { | ||
"rp_1_min": 60, | ||
"rp_5_min": 200, | ||
"rp_15_min": 700, | ||
"rp_30_min": 1000, | ||
"rp_60_min": 2000 | ||
} | ||
} | ||
], | ||
"rate_limiter": { | ||
"rp_1_min": 555, | ||
"rp_5_min": 555, | ||
"rp_15_min": 555, | ||
"rp_30_min": 555, | ||
"rp_60_min": 555 | ||
} | ||
} |
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,20 @@ | ||
version: '3.8' | ||
services: | ||
redis: | ||
image: redis:7.2.4-alpine3.19 | ||
restart: always | ||
ports: | ||
- "6379:6379" | ||
|
||
proxy: | ||
build: | ||
context: ./ | ||
dockerfile: Containerfile | ||
ports: | ||
- "6150:6150" | ||
depends_on: | ||
- redis | ||
environment: | ||
AUTH_APP_CONFIG_PATH: /usr/src/komodo-defi-proxy/assets/.config_test | ||
volumes: | ||
- ./assets:/usr/src/komodo-defi-proxy/assets |
Oops, something went wrong.