diff options
author | d3v11 <d3v11@d3v11.ano> | 2011-11-29 07:20:10 +0000 |
---|---|---|
committer | d3v11 <d3v11@d3v11.ano> | 2011-11-29 07:20:10 +0000 |
commit | 8333b7173e409bc7a3c208bd1541c2ce202315f9 (patch) | |
tree | 2deb52440e27726177c2ed5cd2c9f1b03cac2af6 | |
parent | 9cbe7933d2a9124e21308fddb587d3ab2f4a7e7b (diff) | |
download | resdb-8333b7173e409bc7a3c208bd1541c2ce202315f9.tar.gz resdb-8333b7173e409bc7a3c208bd1541c2ce202315f9.zip |
peer2anonet now asks for the local port
-rwxr-xr-x | contrib/peer2anonet/peer2anonet | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/contrib/peer2anonet/peer2anonet b/contrib/peer2anonet/peer2anonet index 10a14ff..4e6aad3 100755 --- a/contrib/peer2anonet/peer2anonet +++ b/contrib/peer2anonet/peer2anonet @@ -82,13 +82,23 @@ UPDATE(){ exit 1 fi - if [ -e /etc/peer2anonet/peers/"$PEER"/port ]; then - if [[ $(echo X`cat /etc/peer2anonet/peers/"$PEER"/port`) == 'X' ]]; then - echo " fatal error: /etc/peer2anonet/peers/$PEER/port is void" + if [ -e /etc/peer2anonet/peers/"$PEER"/remote_port ]; then + if [[ $(echo X`cat /etc/peer2anonet/peers/"$PEER"/remote_port`) == 'X' ]]; then + echo " fatal error: /etc/peer2anonet/peers/$PEER/remote_port is void" exit 1 fi else - echo " fatal error: /etc/peer2anonet/peers/$PEER/port not exists" + echo " fatal error: /etc/peer2anonet/peers/$PEER/remote_port not exists" + exit 1 + fi + + if [ -e /etc/peer2anonet/peers/"$PEER"/local_port ]; then + if [[ $(echo X`cat /etc/peer2anonet/peers/"$PEER"/local_port`) == 'X' ]]; then + echo " fatal error: /etc/peer2anonet/peers/$PEER/local_port is void" + exit 1 + fi + else + echo " fatal error: /etc/peer2anonet/peers/$PEER/local_port not exists" exit 1 fi @@ -184,7 +194,8 @@ protocol direct direct_AnoNet_routes { table AnoNet_routes; mkdir -p /services/"$PEER" REMOTEIP=`cat /etc/peer2anonet/peers/"$PEER"/remote_ip` PEERIP=`cat /etc/peer2anonet/peers/"$PEER"/peering_ip` - PEERPORT=`cat /etc/peer2anonet/peers/"$PEER"/port` + PEERPORT=`cat /etc/peer2anonet/peers/"$PEER"/remote_port` + LOCALPORT=`cat /etc/peer2anonet/peers/"$PEER"/local_port` PEERASN=`cat /etc/peer2anonet/peers/"$PEER"/asn` PUBKEY=`cat /etc/peer2anonet/peers/"$PEER"/pubkey` SECKEY=`cat /etc/peer2anonet/peers/"$PEER"/seckey` @@ -213,7 +224,7 @@ protocol bgp $PEER { table AnoNet_routes; export REMOTE_ADDRESS=$REMOTEIP export REMOTE_PORT=$PEERPORT -export LOCAL_PORT=20${PEERASN:0:4} +export LOCAL_PORT=$LOCALPORT export PRIVATE_KEY=$SECKEY export PUBLIC_KEY=$PUBKEY export TUN_MODE=1 @@ -262,6 +273,7 @@ CONFIGURE_PEER(){ read -p " Enter your peer's remote ip: " REMOTEIP read -p " Enter your peer's peering ip: " PEERIP read -p " Enter your peer's remote port: " PEERPORT + read -p " Enter your local port: " LOCALPORT read -p " Enter your peer's asn: " PEERASN read -p " Enter your peer's public key: " PUBKEY read -p " Enter your private key: " SECKEY @@ -270,6 +282,7 @@ CONFIGURE_PEER(){ echo $REMOTEIP >/etc/peer2anonet/peers/"$PEER"/remote_ip echo $PEERIP >/etc/peer2anonet/peers/"$PEER"/peering_ip echo $PEERPORT >/etc/peer2anonet/peers/"$PEER"/port + echo $LOCALPORT >/etc/peer2anonet/peers/"$PEER"/local_port echo $PEERASN >/etc/peer2anonet/peers/"$PEER"/asn echo $PUBKEY >/etc/peer2anonet/peers/"$PEER"/pubkey echo $SECKEY >/etc/peer2anonet/peers/"$PEER"/seckey |