the forums at degreez.net

It is currently Thu Mar 28, 2024 2:38 am

All times are UTC - 7 hours [ DST ]




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
PostPosted: Fri Jul 20, 2007 5:33 pm 
Offline

Joined: Fri Jul 20, 2007 5:21 pm
Posts: 5
I have a bittornado tracker (./bttrack.py ) with NAT checking (enabled by default)

then a pc (with 1 phisical internet connection with 3 public ips) with a bittornado client running and using --bind to force it to use a specif ip address...

with that setup the tracker show 1seed (my client) but I am not able to contact that seed from utorrent...

to get everything working i've the client launched with:
Code:
./btlaunchmanycurses.py /torrents.dir/ --max_upload_rate 10 --minport 6881 --maxport 6889 --max_connections 100 --max_uploads 5 --parse_dir_interval 300 --crypto_allowed 1 --crypto_only 0 --crypto_stealth 0 --bind 'myip' --security 1

and the tracker:
Code:
./bttrack.py --port 9696 --dfile dstate --bind 'trackerip' --allow_get 1 --keep_dead 1 --allowed_dir /dir --log_nat_checks 1 --multitracker_enabled 0 --nat_check 0


in this way i'm able to download using another client... but once again, when using a tracker with NAT check i do not appear anymore as seed (neither as leecher)

what can I do?
is ok to have NAT check disabled in order to be able to connect with a bittornado client? :(

is there a way to enable encryption (nat check encryption too) on the tracker too?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 20, 2007 10:04 pm 
Offline

Joined: Tue Mar 14, 2006 11:24 am
Posts: 8
i know nothing at all on this suject
but theres 1 thing i did notice tho and that was the ports you are using.
alot of isp,s tend to block that port range. try ports in the range of 40000-60000 see if this helps

:lol:


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 21, 2007 12:50 am 
Offline

Joined: Fri Jul 20, 2007 5:21 pm
Posts: 5
I'm not using those ports, just posted that as an example of the triggers I use ;)

btw, i think the NAT checking is not the only problem... :(


Top
 Profile  
 
PostPosted: Fri Jul 27, 2007 2:36 pm 
Offline

Joined: Thu Mar 23, 2006 7:52 pm
Posts: 22
evcz wrote:
I have a bittornado tracker (./bttrack.py ) with NAT checking (enabled by default)

then a pc (with 1 phisical internet connection with 3 public ips) with a bittornado client running and using --bind to force it to use a specif ip address...

with that setup the tracker show 1seed (my client) but I am not able to contact that seed from utorrent...

to get everything working i've the client launched with:
Code:
./btlaunchmanycurses.py /torrents.dir/ --max_upload_rate 10 --minport 6881 --maxport 6889 --max_connections 100 --max_uploads 5 --parse_dir_interval 300 --crypto_allowed 1 --crypto_only 0 --crypto_stealth 0 --bind 'myip' --security 1

and the tracker:
Code:
./bttrack.py --port 9696 --dfile dstate --bind 'trackerip' --allow_get 1 --keep_dead 1 --allowed_dir /dir --log_nat_checks 1 --multitracker_enabled 0 --nat_check 0


in this way i'm able to download using another client... but once again, when using a tracker with NAT check i do not appear anymore as seed (neither as leecher)

what can I do?
is ok to have NAT check disabled in order to be able to connect with a bittornado client? :(

is there a way to enable encryption (nat check encryption too) on the tracker too?


I have disabled NAT checking and not had any problems. I don't think it will solve your problem though. --bind only controls what IP the client listens on, not what it uses to connect to the tracker. Since the tracker uses whatever IP you connect with as your IP address, and you are binding to only listen on a different address, that is probably causing your connection problems. Try not using bind instead, and then you should be able to leave nat checking on.

I don't know about encryption, sorry.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 27, 2007 2:41 pm 
Offline

Joined: Fri Jul 20, 2007 5:21 pm
Posts: 5
fixed my problems binding also the http connection to the tracker ;)

edit zurllib.py


replacing:
Code:
def connect(self):
    HTTPConnection.connect(self)
    try:
        self.sock.settimeout(30)
    except:
        pass


with:

Code:
      def connect(self):
        """Connect to the host and port specified in __init__."""
        msg = "getaddrinfo returns an empty list"
        for res in socket.getaddrinfo(self.host, self.port, 0,
                                      socket.SOCK_STREAM):
            af, socktype, proto, canonname, sa = res
            try:
                self.sock = socket.socket(af, socktype, proto)
                self.sock.bind(('x.x.x.x', 0)) #put the ip you want to be  detected by the tracker here
                if self.debuglevel > 0:
                    print "connect: (%s, %s)" % (self.host, self.port)
                self.sock.connect(sa)
            except socket.error, msg:
                if self.debuglevel > 0:
                    print 'connect fail:', (self.host, self.port)
                if self.sock:
                    self.sock.close()
                self.sock = None
                continue
            break


replace
x.x.x.x

with one of mine ips... and now everything is ok... i can bind it to a "secondary" ip address and get everything working ;)

that code is taken from the connect() function available in the python file: "httplib.py".

different python versions have different http connection code.
so it's highly advised to copy that code from your current python file, add the
Code:
self.sock.bind(('x.x.x.x', 0))

just after the socket.socket, and past it into the bittornado zurllib.py :)

PS: something similar should be done also on the https connection code ;)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 23, 2007 4:00 pm 
Offline

Joined: Thu Mar 23, 2006 6:40 pm
Posts: 67
WHAT A BORING PLACE
ITS TIME TO MAKE A MESS


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 05, 2007 2:43 am 
Offline

Joined: Wed Sep 05, 2007 2:30 am
Posts: 1
The following causes all outgoing connections to be bound to a single non-default IP, including HTTP/HTTPS announces and peer connections. This IP must actually be assigned to the network device for this to work.

This does not affect the listening port.

Creds to OP for the HTTP announce part.

I'm still working on a way to make it pick the first item from config['bind'], but that seems a bit more difficult, as config[] isn't stored obviously in a nearby location.

BitTornado-0.3.17

Code:
diff -ur BitTornado-orig/SocketHandler.py BitTornado/SocketHandler.py
--- BitTornado-orig/SocketHandler.py   2007-09-05 03:19:32.000000000 -0500
+++ BitTornado/SocketHandler.py   2007-09-05 03:22:21.000000000 -0500
@@ -236,6 +236,7 @@
         if handler is None:
             handler = self.handler
         sock = socket.socket(socktype, socket.SOCK_STREAM)
+        sock.bind(('172.16.44.11', 0)) # Put the originating IP for outgoing connections here
         sock.setblocking(0)
         try:
             sock.connect_ex(dns)
diff -ur BitTornado-orig/zurllib.py BitTornado/zurllib.py
--- BitTornado-orig/zurllib.py   2007-09-05 03:19:43.000000000 -0500
+++ BitTornado/zurllib.py   2007-09-05 03:22:26.000000000 -0500
@@ -16,7 +16,28 @@
 
 class btHTTPcon(HTTPConnection): # attempt to add automatic connection timeout
     def connect(self):
-        HTTPConnection.connect(self)
+        """Connect to the host and port specified in __init__."""
+        msg = "getaddrinfo returns an empty list"
+        for res in socket.getaddrinfo(self.host, self.port, 0,
+                                      socket.SOCK_STREAM):
+            af, socktype, proto, canonname, sa = res
+            try:
+                self.sock = socket.socket(af, socktype, proto)
+                self.sock.bind(('172.16.44.11', 0)) # Put the originating IP for outgoing connections here
+                if self.debuglevel > 0:
+                    print "connect: (%s, %s)" % (self.host, self.port)
+                self.sock.connect(sa)
+            except socket.error, msg:
+                if self.debuglevel > 0:
+                    print 'connect fail:', (self.host, self.port)
+                if self.sock:
+                    self.sock.close()
+                self.sock = None
+                continue
+            break
+        if not self.sock:
+            raise socket.error, msg
+
         try:
             self.sock.settimeout(30)
         except:
@@ -24,7 +45,14 @@
 
 class btHTTPScon(HTTPSConnection): # attempt to add automatic connection timeout
     def connect(self):
-        HTTPSConnection.connect(self)
+        "Connect to a host on a given (SSL) port."
+
+        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        sock.bind(('172.16.44.11', 0)) # Put the originating IP for outgoing connections here
+        sock.connect((self.host, self.port))
+        ssl = socket.ssl(sock, self.key_file, self.cert_file)
+        self.sock = FakeSocket(sock, ssl)
+
         try:
             self.sock.settimeout(30)
         except:


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 7 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 43 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group