Net-FCP
view release on metacpan or search on metacpan
- added event model autodetection.
- event models supported: Coro, Event, Glib, Tk.
- added Net::FCP::Util.
- bugfixed the case when txn's sent data (when will I learn
to use HEX everywhere...)
- make fmd verify all blocks. or at least most blocks.
0.07 Sun Sep 14 10:57:09 CEST 2003
- handle metadata that doesn't end in a newline.
- fixed txn names to be txn_* instead of *_txn, as per the docs.
- "fix" insert_private_key.
- fix endless loop problem on ClientGet.
- many, many other small fixes.
- added bin/fmd, the not-yet-functional freenet mass downloader.
0.06 Wed Sep 10 07:13:41 CEST 2003
- various small bugfixes.
0.05 Wed Sep 10 07:06:54 CEST 2003
- err, file downloads actually return the right data now.
- implemented non-blocking request writing.
private key and a crypto key, which is just additional entropy.
[
"acLx4dux9fvvABH15Gk6~d3I-yw",
"cPoDkDMXDGSMM32plaPZDhJDxSs",
"BH7LXCov0w51-y9i~BoB3g",
]
A private key (for inserting) can be constructed like this:
SSK@<private_key>,<crypto_key>/<name>
It can be used to insert data. The corresponding public key looks like this:
SSK@<public_key>PAgM,<crypto_key>/<name>
Watch out for the C<PAgM>-part!
=cut
$txn->(generate_svk_pair => sub {
my ($self) = @_;
$self->txn ("generate_svk_pair");
});
=item $txn = $fcp->txn_invert_private_key ($private)
=item $public = $fcp->invert_private_key ($private)
Inverts a private key (returns the public key). C<$private> can be either
an insert URI (must start with C<freenet:SSK@>) or a raw private key (i.e.
the private value you get back from C<generate_svk_pair>).
Returns the public key.
=cut
$txn->(invert_private_key => sub {
my ($self, $privkey) = @_;
$self->txn (invert_private_key => private => $privkey);
});
=item $txn = $fcp->txn_get_size ($uri)
=item $length = $fcp->get_size ($uri)
Finds and returns the size (rounded up to the nearest power of two) of the
given document.
=cut
=item my $uri = $fcp->client_put ($uri, $metadata, $data, $htl, $removelocal);
Insert a new key. If the client is inserting a CHK, the URI may be
abbreviated as just CHK@. In this case, the node will calculate the
CHK. If the key is a private SSK key, the node will calculcate the public
key and the resulting public URI.
C<$meta> can be a hash reference (same format as returned by
C<Net::FCP::parse_metadata>) or a string.
The result is an arrayref with the keys C<uri>, C<public_key> and C<private_key>.
=cut
$txn->(client_put => sub {
my ($self, $uri, $metadata, $data, $htl, $removelocal) = @_;
$metadata = Net::FCP::Metadata::build_metadata $metadata;
$uri =~ s/^freenet://; $uri = "freenet:$uri";
$self->txn (client_put => URI => $uri,
$self->set_result ($attr->{uri});
}
package Net::FCP::Txn::GenerateSVKPair;
use base Net::FCP::Txn;
sub rcv_success {
my ($self, $attr) = @_;
$self->set_result ([$attr->{public_key}, $attr->{private_key}, $attr->{crypto_key}]);
}
package Net::FCP::Txn::InvertPrivateKey;
use base Net::FCP::Txn;
sub rcv_success {
my ($self, $attr) = @_;
$self->set_result ($attr->{public_key});
}
private key and a crypto key, which is just additional entropy.
[
"acLx4dux9fvvABH15Gk6~d3I-yw",
"cPoDkDMXDGSMM32plaPZDhJDxSs",
"BH7LXCov0w51-y9i~BoB3g",
]
A private key (for inserting) can be constructed like this:
SSK@<private_key>,<crypto_key>/<name>
It can be used to insert data. The corresponding public key looks
like this:
SSK@<public_key>PAgM,<crypto_key>/<name>
Watch out for the "PAgM"-part!
$txn = $fcp->txn_invert_private_key ($private)
$public = $fcp->invert_private_key ($private)
Inverts a private key (returns the public key). $private can be
either an insert URI (must start with "freenet:SSK@") or a raw
private key (i.e. the private value you get back from
"generate_svk_pair").
Returns the public key.
$txn = $fcp->txn_get_size ($uri)
$length = $fcp->get_size ($uri)
Finds and returns the size (rounded up to the nearest power of two)
my $uri = $fcp->client_put ($uri, $metadata, $data, $htl, $removelocal);
Insert a new key. If the client is inserting a CHK, the URI may be
abbreviated as just CHK@. In this case, the node will calculate the
CHK. If the key is a private SSK key, the node will calculcate the
public key and the resulting public URI.
$meta can be a hash reference (same format as returned by
"Net::FCP::parse_metadata") or a string.
The result is an arrayref with the keys "uri", "public_key" and
"private_key".
THE Net::FCP::Txn CLASS
All requests (or transactions) are executed in a asynchronous way. For
each request, a "Net::FCP::Txn" object is created (worse: a tcp
connection is created, too).
For each request there is actually a different subclass (and it's
possible to subclass these, although of course not documented).
The most interesting method is "result".
( run in 0.253 second using v1.01-cache-2.11-cpan-a5abf4f5562 )