This commit is contained in:
Para Dox
2025-04-12 11:45:19 +07:00
parent 4cd47f1d04
commit e8f8f8b0b2
6 changed files with 8 additions and 67 deletions

View File

@@ -9,7 +9,7 @@ while IFS= read -r line; do
blacklist+=("$line")
done < "$BASEPATH/path-blacklist.txt"
pathlist=$(cat $BASEPATH/$1.yml | grep -oP "(?<=stripprefix\.prefixes).*\"" | cut -d'=' -f2- | sed 's/.$//')
pathlist=$(cat $BASEPATH/$1.yml | grep -oP "stripprefix\.prefixes.*?/\K[^\"]+")
for path in $pathlist; do
include=true
@@ -20,7 +20,7 @@ for path in $pathlist; do
done
if $include; then
RPC_URL="https://$DOMAIN$path"
RPC_URL="https://$DOMAIN/$path"
response_file=$(mktemp)
http_status_code=$(curl --ipv4 -m 1 -s -X POST -w "%{http_code}" -o "$response_file" -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest", false],"id":1}' $RPC_URL)

View File

@@ -1,24 +0,0 @@
#!/bin/bash
BASEPATH="$(dirname "$0")"
source $BASEPATH/.env
IFS=':' read -ra parts <<< $COMPOSE_FILE
json=$(cat "$BASEPATH/reference-rpc-endpoint.json")
default_array=()
for key in $(jq -r 'keys[]' <<< "$json"); do
default_values=$(jq -r ".[\"$key\"].default[]" <<< "$json")
default_array+=($default_values)
for node in "${default_values[@]}"; do
size_in_gb=$($BASEPATH/restore-volumes.sh "$node" --print-size-only)
if [ $? -eq 0 ]; then
echo "$key;$node;$size_in_gb"
fi
done
done

View File

@@ -16,7 +16,7 @@ if [ -n "$NO_SSL" ]; then
DOMAIN="${DOMAIN:-0.0.0.0}"
fi
pathlist=$(cat $BASEPATH/$1.yml | grep -oP "(?<=stripprefix\.prefixes).*\"" | cut -d'=' -f2- | sed 's/.$//')
pathlist=$(cat $BASEPATH/$1.yml | grep -oP "stripprefix\.prefixes.*?/\K[^\"]+")
for path in $pathlist; do
include=true
@@ -27,7 +27,7 @@ for path in $pathlist; do
done
if $include; then
RPC_URL="${PROTO:-https}://$DOMAIN$path"
RPC_URL="${PROTO:-https}://$DOMAIN/$path"
if curl -L -s -X POST $RPC_URL -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest",false],"id":1}' | jq -r '.result.number, .result.hash' | gawk '{if (NR==1) print "Block Number:", strtonum($0); else print "Block Hash:", $0}'; then
exit 0

View File

@@ -1,35 +0,0 @@
#!/bin/bash
BASEPATH="$(dirname "$0")"
source $BASEPATH/.env
IFS=':' read -ra parts <<< $COMPOSE_FILE
blacklist=("drpc.yml" "drpc-free.yml" "base.yml" "rpc.yml" "monitoring.yml" "ftp.yml" "backup-http.yml")
for part in "${parts[@]}"; do
include=true
for word in "${blacklist[@]}"; do
if echo "$part" | grep -qE "$word"; then
#echo "The path $path contains a blacklisted word: $word"
include=false
fi
done
if $include; then
default=$(jq -r "to_entries[] | select(.value.default[]? == \"${part%.yml}\") | .key" $BASEPATH/reference-rpc-endpoint.json)
archive=$(jq -r "to_entries[] | select(.value.archive[]? == \"${part%.yml}\") | .key" $BASEPATH/reference-rpc-endpoint.json)
if [ -n "$archive" ]; then
echo "${archive}_archive"
elif [ -n "$default" ]; then
echo "${default}_default"
else
exit 1
fi
fi
done

View File

@@ -9,7 +9,7 @@ while IFS= read -r line; do
blacklist+=("$line")
done < "$BASEPATH/path-blacklist.txt"
pathlist=$(cat "$BASEPATH/$1.yml" | grep -oP "(?<=stripprefix\.prefixes).*\"" | cut -d'=' -f2- | sed 's/.$//')
pathlist=$(cat "$BASEPATH/$1.yml" | grep -oP "stripprefix\.prefixes.*?/\K[^\"]+")
for path in $pathlist; do
include=true
@@ -20,7 +20,7 @@ for path in $pathlist; do
done
if $include; then
RPC_URL="https://$DOMAIN$path"
RPC_URL="https://$DOMAIN/$path"
response_file=$(mktemp)
http_status_code=$(curl --ipv4 -m 1 -s -X POST -w "%{http_code}" -o "$response_file" -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest", false],"id":1}' "$RPC_URL")

View File

@@ -16,7 +16,7 @@ else
PROTO="https"
fi
pathlist=$(cat $BASEPATH/$1.yml | grep -oP "(?<=PathPrefix).*\"" | cut -d'`' -f2-2)
pathlist=$(cat $BASEPATH/$1.yml | grep -oP "stripprefix\.prefixes.*?/\K[^\"]+")
for path in $pathlist; do
include=true
@@ -27,7 +27,7 @@ for path in $pathlist; do
done
if $include; then
RPC_URL="$PROTO://$DOMAIN$path"
RPC_URL="$PROTO://$DOMAIN/$path"
ref=''
if [ -n "$2" ]; then