Mercurial > hg > anonet-resdb
changeset 803:3761c3e87765 draft
peer2anonet now asks for the local port
author | d3v11 <d3v11@d3v11.ano> |
---|---|
date | Tue, 29 Nov 2011 07:20:10 +0000 |
parents | 4fb17fd5b4b0 |
children | 0ab988a1cec7 |
files | contrib/peer2anonet/peer2anonet |
diffstat | 1 files changed, 19 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/peer2anonet/peer2anonet Tue Nov 29 05:23:06 2011 +0000 +++ b/contrib/peer2anonet/peer2anonet Tue Nov 29 07:20:10 2011 +0000 @@ -82,13 +82,23 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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