Re: Implementing a Gnutella-structured network only with basic HTTP possible?Date: Wed, 24 Feb 2010 09:08:15 +0000 (UTC)Date: Fri, 26 Feb 2010 12:55:15 +0000 (UTC)Date: Fri, 26 Feb 2010 19:44:11 +0000 (UTC)

[email protected] Fri, 26 Feb 2010 20:44:13 +0100
Newsgroups gmane.network.gnutella.devel
Organization Home, Grenoble, France
Message-ID <[email protected]>
Arne, I have good news for you...

Quoting Arne Babenhauserheide <[email protected]> from ml.gnutella.dev-forum:
:Each one of these components could provide an API to access it. Ideally it 
:would be as simple as
:
:from gtkg import Gnutella, Dht, Download
:Gnutella.start() # includes bootstrap
:Dht.start()
:results = Gnutella.search_by_string("GnuFU")
:# (periodically check results)
:dl = results[25].download()
:dl2 = Download.magnet("magnet:?xt=…&xs=…(tracker)…&as=…(websource)…")
:dl3 = results[25].download_to("/home/arne/downloads/infinite-hands.ogg")
:# (wait)
:dl.status()
:dl.done
:dl2.abort()

What you write above is a scripting language on top of a p2p engine.  With
little work, there's nothing that prevents it from being done TODAY (no need
to wait for Gnutella 3.0).

"All" you need is to hook up the scripting language to the core of a running
servent.

I could do that in less than 1 man.month for gtk-gnutella, in Perl.
A little more in Python.

Hopefully, here, nobody really cares about what the underlying Gnutella
engine is, so if you're careful to craft a nice API, it could (in theory)
be implemented on all different servents to give you a unified programatic
access to the core.

You're welcome to try to do it for Phex first.  But be careful, it must
be an API that hooks up to the core through a socket and then communicates
with the Gnutella servent using a command text interface (i.e. no cheating
by using internal data structures, otherwise your interface will not be
portable accross servents).

Then all servents will need to implement this text interface.  Think SMTP
or NTTP server: you can hook up any mail or news reader agent.  Naturally,
the set of commands implemented by a Gnutella servent is going to be different
than those of an NNTP server, but you get the idea.

For instance, in gtk-gnutella you can say today, from your shell:

	$ echo download add magnet:...... | gtk-gnutella --shell

and create a download request for that magnet.  You can also request library
rescans:

	$ echo rescan | gtk-gnutella --shell
	100-Started library rescan

Or monitor internal statistics.  For instance:

	$ echo stats | gtk-gnutella --shell | grep ^dht_estim
	dht_estimated_size 516275

Nothing standard however, we implemented the commands we needed whenever the
need for them arose.  And it's not a programatic language, it's a command
interface.

Raphael