mirror of
https://github.com/imapsync/imapsync.git
synced 2025-08-02 07:11:48 +02:00
1.678
This commit is contained in:
parent
c16227350f
commit
629adbb8db
113 changed files with 7581 additions and 43297 deletions
46
W/learn/net_dns_srv_imap
Executable file
46
W/learn/net_dns_srv_imap
Executable file
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict ;
|
||||
use warnings ;
|
||||
use Net::DNS;
|
||||
|
||||
|
||||
|
||||
lookup_srv( '_imaps._tcp.gmail.com' ) ;
|
||||
lookup_srv( '_imap._tcp.gmail.com' ) ;
|
||||
|
||||
sub lookup_srv {
|
||||
my $name = shift ;
|
||||
|
||||
my $resolver = new Net::DNS::Resolver( ) ;
|
||||
my $reply = $resolver->query( $name, 'SRV' ) ;
|
||||
|
||||
if ( $reply ) {
|
||||
#($reply->answer)[0]->print;
|
||||
foreach my $rr ($reply->answer) {
|
||||
print $rr->name . "\n" ;
|
||||
print $rr->class . "\n" ;
|
||||
print $rr->type . "\n" ;
|
||||
print $rr->ttl . "\n" ;
|
||||
print $rr->string . "\n" ;
|
||||
}
|
||||
} else {
|
||||
print "query failed: ", $resolver->errorstring, "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub lookup_address {
|
||||
# Perform a lookup, using the searchlist if appropriate.
|
||||
my $resolver = new Net::DNS::Resolver( ) ;
|
||||
my $reply = $resolver->search( 'example.com' );
|
||||
if ($reply) {
|
||||
foreach my $rr ($reply->answer) {
|
||||
next unless $rr->type eq "A";
|
||||
print $rr->address, "\n";
|
||||
}
|
||||
} else {
|
||||
warn "query failed: ", $resolver->errorstring, "\n";
|
||||
}
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue