ipv4
This commit is contained in:
@@ -31,7 +31,7 @@ if [ ! -d "$LOCAL_DIR" ]; then
|
||||
|
||||
for file in "${files[@]}"; do
|
||||
echo "Processing: $file"
|
||||
curl -# "${base_url}${file}" | zstd -d | tar -xvf - -C /
|
||||
curl --ipv4 -# "${base_url}${file}" | zstd -d | tar -xvf - -C /
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error processing $file"
|
||||
|
||||
@@ -109,17 +109,17 @@ echo "=========================================="
|
||||
echo "DEBUG: Manual curl commands"
|
||||
echo "=========================================="
|
||||
echo "To fetch peers from source, run:"
|
||||
echo "curl --ipv4 -X POST -H \"Content-Type: application/json\" --data '{\"jsonrpc\":\"2.0\",\"method\":\"admin_peers\",\"params\":[],\"id\":1}' \"$SOURCE_URL\""
|
||||
echo "curl -X POST -H \"Content-Type: application/json\" --data '{\"jsonrpc\":\"2.0\",\"method\":\"admin_peers\",\"params\":[],\"id\":1}' \"$SOURCE_URL\""
|
||||
echo ""
|
||||
echo "To add a peer to target, run:"
|
||||
echo "curl --ipv4 -X POST -H \"Content-Type: application/json\" --data '{\"jsonrpc\":\"2.0\",\"method\":\"admin_addPeer\",\"params\":[\"<enode>\"],\"id\":1}' \"$TARGET_URL\""
|
||||
echo "curl -X POST -H \"Content-Type: application/json\" --data '{\"jsonrpc\":\"2.0\",\"method\":\"admin_addPeer\",\"params\":[\"<enode>\"],\"id\":1}' \"$TARGET_URL\""
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
|
||||
# Run the command to get the list of enode strings from source
|
||||
echo "Fetching peers from source node..."
|
||||
echo "DEBUG: Executing: curl --ipv4 -X POST -H \"Content-Type: application/json\" --data '{\"jsonrpc\":\"2.0\",\"method\":\"admin_peers\",\"params\":[],\"id\":1}' \"$SOURCE_URL\""
|
||||
enodes=$(curl --ipv4 -X POST -H "Content-Type: application/json" --silent --data "{\"jsonrpc\":\"2.0\",\"method\":\"admin_peers\",\"params\":[],\"id\":1}" "$SOURCE_URL" | jq -r '.result[].enode' 2>/dev/null)
|
||||
echo "DEBUG: Executing: curl -X POST -H \"Content-Type: application/json\" --data '{\"jsonrpc\":\"2.0\",\"method\":\"admin_peers\",\"params\":[],\"id\":1}' \"$SOURCE_URL\""
|
||||
enodes=$(curl -X POST -H "Content-Type: application/json" --silent --data "{\"jsonrpc\":\"2.0\",\"method\":\"admin_peers\",\"params\":[],\"id\":1}" "$SOURCE_URL" | jq -r '.result[].enode' 2>/dev/null)
|
||||
|
||||
# Check if the command was successful
|
||||
if [ $? -ne 0 ] || [ -z "$enodes" ]; then
|
||||
@@ -141,8 +141,8 @@ while IFS= read -r enode; do
|
||||
fi
|
||||
|
||||
echo "Adding peer: ${enode:0:50}..."
|
||||
echo "DEBUG: Executing: curl --ipv4 -X POST -H \"Content-Type: application/json\" --data '{\"jsonrpc\":\"2.0\",\"method\":\"admin_addPeer\",\"params\":[\"${enode}\"],\"id\":1}' \"$TARGET_URL\""
|
||||
result=$(curl --ipv4 -X POST -H "Content-Type: application/json" --silent --data "{\"jsonrpc\":\"2.0\",\"method\":\"admin_addPeer\",\"params\":[\"${enode}\"],\"id\":1}" "$TARGET_URL" | jq -r '.result' 2>/dev/null)
|
||||
echo "DEBUG: Executing: curl -X POST -H \"Content-Type: application/json\" --data '{\"jsonrpc\":\"2.0\",\"method\":\"admin_addPeer\",\"params\":[\"${enode}\"],\"id\":1}' \"$TARGET_URL\""
|
||||
result=$(curl -X POST -H "Content-Type: application/json" --silent --data "{\"jsonrpc\":\"2.0\",\"method\":\"admin_addPeer\",\"params\":[\"${enode}\"],\"id\":1}" "$TARGET_URL" | jq -r '.result' 2>/dev/null)
|
||||
|
||||
if [ "$result" = "true" ] || [ "$result" = "null" ]; then
|
||||
echo " ✓ Success"
|
||||
|
||||
@@ -15,4 +15,4 @@ request="{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"
|
||||
|
||||
echo "${request}"
|
||||
|
||||
curl -s -X POST "${1}" -H "Content-Type: application/json" --data "${request}" | jq -r '.result.number, .result.hash' | gawk '{if (NR==1) print "Block Number:", strtonum($0); else print "Block Hash:", $0}'
|
||||
curl --ipv4 -s -X POST "${1}" -H "Content-Type: application/json" --data "${request}" | jq -r '.result.number, .result.hash' | gawk '{if (NR==1) print "Block Number:", strtonum($0); else print "Block Hash:", $0}'
|
||||
|
||||
@@ -31,13 +31,13 @@ for path in $pathlist; do
|
||||
if $include; then
|
||||
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\":[\"${blocktag}\",false],\"id\":1}" | jq -r '.result.number, .result.hash' | gawk '{if (NR==1) print "Block Number:", strtonum($0); else print "Block Hash:", $0}'; then
|
||||
if curl --ipv4 -L -s -X POST $RPC_URL -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"${blocktag}\",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
|
||||
else
|
||||
if curl -L -s -X POST $RPC_URL -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"${blocktag}\",false],\"id\":1}" | jq; then
|
||||
if curl --ipv4 -L -s -X POST $RPC_URL -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"${blocktag}\",false],\"id\":1}" | jq; then
|
||||
exit 1
|
||||
else
|
||||
curl -L -vv -X POST $RPC_URL -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"${blocktag}\",false],\"id\":1}"
|
||||
curl --ipv4 -L -vv -X POST $RPC_URL -H "Content-Type: application/json" --data "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"${blocktag}\",false],\"id\":1}"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
curl -s $1 | grep -oP 'rpc_[^"]*\.tar\.zst' | sort -u
|
||||
curl --ipv4 -s $1 | grep -oP 'rpc_[^"]*\.tar\.zst' | sort -u
|
||||
|
||||
@@ -59,7 +59,7 @@ for file in "${restore_files[@]}"; do
|
||||
echo "Error: /backup directory does not exist. download from http and extract directly to /var/lib/docker"
|
||||
|
||||
|
||||
curl -# "${2}${file}" | zstd -d | tar -xvf - --dereference -C /
|
||||
curl --ipv4 -# "${2}${file}" | zstd -d | tar -xvf - --dereference -C /
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error processing $file"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd /root/rpc
|
||||
sed -i.bak "s/IP=.*/IP=$(curl ipinfo.io/ip)/g" .env
|
||||
sed -i.bak "s/IP=.*/IP=$(curl --ipv4 ipinfo.io/ip)/g" .env
|
||||
docker compose up -d
|
||||
|
||||
Reference in New Issue
Block a user