Net-DirectConnect

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

            "ExtUtils::MakeMaker" : "0"
         }
      },
      "runtime" : {
         "requires" : {
            "Crypt::RHash" : "0",
            "DBD::SQLite" : "0",
            "DBI" : "0",
            "IO::Compress::Bzip2" : "0",
            "IO::Socket::IP" : "0",
            "IO::Socket::SSL" : "0",
            "JSON" : "0",
            "JSON::XS" : "0",
            "MIME::Base32" : "0",
            "Sys::Sendfile" : "0",
            "Time::HiRes" : "0",
            "lib::abs" : "0"
         }
      }
   },
   "release_status" : "stable",

META.yml  view on Meta::CPAN

no_index:
  directory:
    - t
    - inc
requires:
  Crypt::RHash: 0
  DBD::SQLite: 0
  DBI: 0
  IO::Compress::Bzip2: 0
  IO::Socket::IP: 0
  IO::Socket::SSL: 0
  JSON: 0
  JSON::XS: 0
  MIME::Base32: 0
  Sys::Sendfile: 0
  Time::HiRes: 0
  lib::abs: 0
version: 0.14

Makefile.PL  view on Meta::CPAN

    #'MIME::Base32'        => 0,    #for adc only
    #'Sys::Sendfile'       => 0,    #faster file sending
    'IO::Compress::Bzip2'           => 0,    #preparing filelists
    'DBI'                           => 0,
    'DBD::SQLite'                   => 0,
    #'Net::DirectConnect::TigerHash' => 0,
    'Crypt::RHash'                  => 0,
    'IO::Socket::IP'                => 0,
    #'IO::Socket::INET6'             => 0,
    #'Socket6'                       => 0,
    'IO::Socket::SSL' => 0,
    'JSON'            => 0,
    'JSON::XS'        => 0,
  },
  NORECURS  => 1,
  EXE_FILES => [qw(examples/dcshare examples/dcget examples/dchub)],
);
$_{dist} = {
  PREOP    => "pod2text $_{VERSION_FROM} | tee README >\$(DISTVNAME)/README; chmod -R u=rwX,go=rX . ;",
  COMPRESS => 'gzip -9v',
  SUFFIX   => '.gz',

README  view on Meta::CPAN

    look at examples for handlers

DESCRIPTION
     Currently NOT supported:
     segmented, multisource download;
     async connect;

INSTALLATION
     To install this module type the following:

       cpan DBD::SQLite IO::Socket::IP IO::Socket::INET6 IO::Socket::SSL
       perl Makefile.PL && make install clean

     debian:
     apt-get install libdbd-sqlite3-perl libio-socket-ip-perl libjson-xs-perl libjson-perl libmime-base32-perl liblib-abs-perl

SEE ALSO
     latest snapshot
     svn co svn://svn.setun.net/dcppp/trunk/ dcppp

     http://svn.setun.net/dcppp/timeline/browser/trunk

lib/Net/DirectConnect.pm  view on Meta::CPAN

  $self->log(
    'err',
    "connect socket  error: $@,",
    Encode::decode( $self->{charset_fs}, $!, Encode::FB_WARN ),
    "[$self->{'socket'}]"
    ),
    return 1
    if !$self->{'socket'};
  #$self->log( 'dev',  'timeout to', $self->{'Timeout'});
  $self->{'socket'}->timeout( $self->{'Timeout'} ) if $self->{'Timeout'};    #timeout must be after new, ifyou want nonblocking
       #$self->log( 'dev',  'ssltry'), IO::Socket::SSL->start_SSL($self->{'socket'}) if $self->{'protocol'} eq 'adcs';
       #$self->log( 'err', "connect socket  error: $@, $! [$self->{'socket'}]" ), return 1 if !$self->{'socket'};
       #$self->{'socket'}->binmode(":encoding($self->{charset_protocol})");
       #$self->{charset_protocol} = 'utf8';
       #$self->log( 'dev', "set encoding of socket to [$self->{charset_protocol}]");
       #    binmode($self->{'socket'}, ":encoding($self->{charset_protocol})");
       #    binmode($self->{'socket'}, ":raw:encoding($self->{charset_protocol})");
       #    binmode($self->{'socket'}, ":encoding($self->{charset_protocol}):bytes");
       #    binmode($self->{'socket'}, ":$self->{charset_protocol}");
       #eval {$self->{'socket'}->fcntl( Fcntl::O_ASYNC,1);};    $self->log('warn', "cant Fcntl::O_ASYNC : $@") if $@;
       #eval {$self->{'socket'}->fcntl( Fcntl::O_NONBLOCK,1);};    $self->log('warn', "cant Fcntl::O_NONBLOCK : $@") if $@;

lib/Net/DirectConnect.pm  view on Meta::CPAN

  };
  $self->log( 'info', "my internal ip detected, using passive mode", $self->{'myip'}, $self->{'hostip'}, $localmask ),
    $self->{'M'} = 'P'
    if !$self->{'M'}
    and $is_local_ip->( $self->{'myip'} )
    and !$is_local_ip->( $self->{'hostip'} );
  $self->{'M'} ||= 'A';
  #$self->log( 'info', "mode set [$self->{'M'}] ");
  $self->log( 'info', "connect to $self->{'host'}($self->{'hostip'}):$self->{'port'} [me=$self->{'myip'}] ok ", );
  #$self->log( $self, 'connected1 inited', "MT:$self->{'message_type'}", ' with' );
  #$self->log( 'dev',  'ssltry'),IO::Socket::SSL->start_SSL($self->{'socket'}) if $self->{'protocol'} eq 'adcs';
  $self->connect_aft();
}

sub reconnect {    #$self->{'reconnect'} ||= sub {
  my $self = shift;
  #$self->log(          'dev', 'reconnect');
  $self->disconnect();
  $self->{'status'} = 'reconnecting';
  #!sleep $self->{'reconnect_sleep'};
  #!$self->connect();

lib/Net/DirectConnect.pm  view on Meta::CPAN


 Currently NOT supported:
 segmented, multisource download;
 async connect;


=head1 INSTALLATION

 To install this module type the following:

   cpan DBD::SQLite IO::Socket::IP IO::Socket::INET6 IO::Socket::SSL
   perl Makefile.PL && make install clean

 debian:
 apt-get install libdbd-sqlite3-perl libio-socket-ip-perl libjson-xs-perl libjson-perl libmime-base32-perl liblib-abs-perl

=head1 SEE ALSO

 latest snapshot
 svn co svn://svn.setun.net/dcppp/trunk/ dcppp

lib/Net/DirectConnect/adcs.pm  view on Meta::CPAN

openssl s_client -debug -connect 127.0.0.1:413

=cut
package    #hide from cpan
  Net::DirectConnect::adcs;
use strict;
no strict qw(refs);
use warnings "NONFATAL" => "all";
no warnings qw(uninitialized);
no if $] >= 5.017011, warnings => 'experimental::smartmatch';
use IO::Socket::SSL;
#use IO::Socket::SSL qw(debug4);
use Data::Dumper;    #dev only
#$Data::Dumper::Sortkeys = $Data::Dumper::Useqq = $Data::Dumper::Indent = 1;
sub init {
  my $self = shift if ref $_[0];
  $self->module_load('adc');
  #$self->log( 'ssl', $self->{'protocol'}, $self->{'auto_listen'} );
  $self->{'protocol_supported'}{'ADCS/0.10'} = 'adcs';
  #$self->log( 'dev', 'sslinit', $self->{'protocol'} ),
  $self->{'socket_class'} = 'IO::Socket::SSL'
    if
    #!$self->{hub} and
    $self->{'protocol'} eq 'adcs'
    #and !$self->{'auto_listen'}
    ;
  local %_ = (
    'recv' => 'read',
    'send' => 'syswrite',
    'protocol_connect'   => 'ADCS/0.10',
  );
  $self->{$_} = $_{$_} for keys %_;
  #$self->log( 'dev', 'adcsset', $self->{'protocol_connect'});
  local %_ = (
    SSL_server      => $self->{'auto_listen'},
    SSL_verify_mode => 0,
    SSL_version     => 'TLSv1',
  );
  $self->{'socket_options'}{$_} = $_{$_} for keys %_;
# $self->log( 'dev',  'sockopt',      %{$self->{'socket_options'}},);
#IO::Socket::SSL->start_SSL( SSL_server => 1, $self->{'socket'}, %{ $self->{'socket_options'} || {} } )    if $self->{'socket'} and $self->{'proto}col'} eq 'adcs' and $self->{'incoming'};
  if (
    !$self->{'no_listen'}    #) {
#$self->log( 'dev', 'nyportgen',"$self->{'M'} eq 'A' or !$self->{'M'} ) and !$self->{'auto_listen'} and !$self->{'incoming'}" );
#    if (
    and
    #( $self->{'M'} eq 'A' or !$self->{'M'} )  and
    !$self->{'incoming'} and !$self->{'auto_listen'}
    )
  {
    $self->log( 'dev', "making listeners: tls", "h=$self->{'hub'}" );



( run in 0.508 second using v1.01-cache-2.11-cpan-4d50c553e7e )