public-inbox.git  about / heads / tags
an "archives first" approach to mailing lists
blob 41b608110addec495c15e5b35918f1486b2d76d9 873 bytes (raw)
$ git show HEAD:xt/net_nntp_socks.t	# shows this blob on the CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
 
#!perl -w
# Copyright (C) 2021 all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
use v5.12;
use PublicInbox::TestCommon;
use URI;
require_mods 'IO::Socket::Socks';
use_ok 'PublicInbox::NetNNTPSocks';
my $url = $ENV{TEST_NNTP_ONION_URL} //
	'nntp://ie5yzdi7fg72h7s4sdcztq5evakq23rdt33mfyfcddc5u3ndnw24ogqd.onion/inbox.comp.mail.public-inbox.meta';
my $uri = URI->new($url);
my $on = PublicInbox::NetNNTPSocks->new_socks(
	Port => $uri->port,
	Host => $uri->host,
	ProxyAddr => '127.0.0.1', # default Tor address + port
	ProxyPort => 9050,
) or xbail('err = '.eval('$IO::Socket::Socks::SOCKS_ERROR'));
my ($nr, $min, $max, $grp) = $on->group($uri->group);
ok($nr > 0 && $min > 0 && $min < $max, 'nr, min, max make sense') or
	diag explain([$nr, $min, $max, $grp]);
is($grp, $uri->group, 'group matches');
done_testing;

git clone https://public-inbox.org/public-inbox.git
git clone http://7fh6tueqddpjyxjmgtdiueylzoqt6pt7hec3pukyptlmohoowvhde4yd.onion/public-inbox.git