Created
March 29, 2023 22:00
-
-
Save nullpilot/68bd7fe8d64d16a11cf07ed43d2cedb1 to your computer and use it in GitHub Desktop.
Public PAW RPC endpoint
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
{ | |
order rate_limit before basicauth | |
order json_parse after request_body | |
} | |
rpc.pawmon.live { | |
json_parse | |
@public_actions { | |
method POST | |
path / | |
vars json.action "accounts_balances" "accounts_frontiers" "accounts_pending" "account_info" "account_history" "active_difficulty" "block_count" "block_info" "blocks_info" "confirmation_history" "confirmation_quorum" "peers" "pending" "representatives" "representatives_online" "uptime" "version" "delegators" | |
} | |
@protected_actions { | |
method POST | |
path / | |
vars json.action "process" | |
} | |
@work_generate { | |
method POST | |
path / | |
vars json.action "work_generate" | |
} | |
@options { | |
method OPTIONS | |
} | |
handle @public_actions { | |
rate_limit { | |
zone actions_30m { | |
key {remote_host} | |
events 60 | |
window 30m | |
} | |
} | |
rate_limit { | |
zone actions_24h { | |
key {remote_host} | |
events 1200 | |
window 24h | |
} | |
} | |
reverse_proxy http://[::1]:7246 | |
} | |
handle @protected_actions { | |
rate_limit { | |
zone actions_30m { | |
key {remote_host} | |
events 60 | |
window 30m | |
} | |
} | |
rate_limit { | |
zone actions_24h { | |
key {remote_host} | |
events 300 | |
window 24h | |
} | |
} | |
reverse_proxy http://[::1]:7246 | |
} | |
handle @work_generate { | |
rate_limit { | |
zone actions_30m_work { | |
key {remote_host} | |
events 60 | |
window 30m | |
} | |
} | |
rate_limit { | |
zone actions_24h_work { | |
key {remote_host} | |
events 300 | |
window 24h | |
} | |
} | |
reverse_proxy http://127.0.0.1:7300 { | |
header_down Access-Control-Allow-Origin "*" | |
header_down Access-Control-Allow-Methods "POST, OPTIONS" | |
header_down Access-Control-Allow-Headers "accept, accept-language, content-language, content-type" | |
} | |
} | |
handle @options { | |
header { | |
Access-Control-Allow-Origin "*" | |
Access-Control-Allow-Methods "POST, OPTIONS" | |
Access-Control-Allow-Headers "accept, accept-language, content-language, content-type" | |
} | |
} | |
handle * { | |
respond "Feel free to use this server as endpoint in Biome or Biota" | |
} | |
} |
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
xcaddy build --output ./caddy_rpc --with github.com/RussellLuo/caddy-ext/ratelimit --with github.com/RussellLuo/caddy-ext/requestbodyvar |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment