STUN::Client - Session Traversal Utilities for NAT (STUN) client. (RFC 5389)
use STUN::Client; use Data::Dumper; $stun_client = STUN::Client->new; $stun_client->stun_server('stun.server.org'); ($r_old, $r_new) = $stun_client->get; print Dumper($r_old); print Dumper($r_new);
Session Traversal Utilities for NAT (STUN) is a protocol that serves as a tool for other protocols in dealing with Network Address Translator (NAT) traversal. It can be used by an endpoint to determine the IP address and port allocated to it by a NAT. It can also be used to check connectivity between two endpoints, and as a keep-alive protocol to maintain NAT bindings. STUN works with many existing NATs, and does not require any special behavior from them.
STUN is not a NAT traversal solution by itself. Rather, it is a tool to be used in the context of a NAT traversal solution.
Hostname of STUN server.
Protocol to use for connect, 'udp' or 'tcp'.
Port number of STUN server.
Local Internet address.
Local port number, but it is necessary that local_address is explicity.
The client retries the request, this time including its username and the realm, and echoing the nonce provided by the server. The client also includes a message-integrity, which provides an HMAC over the entire request, including the nonce. The server validates the nonce and checks the message integrity. If they match, the request is authenticated. If the nonce is no longer valid, it is considered "stale", and the server rejects the request, providing a new nonce.
Retransmit a STUN request message starting with an interval of RTO ("Retransmission TimeOut"), doubling after each retransmission.
STUN methods in the range 0x000 - 0x7FF are assigned by IETF Review [RFC5226]. STUN methods in the range 0x800 - 0xFFF are assigned by Designated Expert [RFC5226].
Data to send in package.
Connect to a stun_server and receive the answer. The first argument returned is a hash reference in the format retuned by the versions previous to 0.04. The second argument is a hash reference as returned by STUN::RFC_5389.
* stun.ekiga.net * stun.fwdnet.net * stun.ideasip.com * stun01.sipphone.com (no DNS SRV record) * stun.softjoys.com (no DNS SRV record) * stun.voipbuster.com (no DNS SRV record) * stun.voxgratia.org (no DNS SRV record) * stun.xten.com * stunserver.org see their usage policy * stun.sipgate.net:10000
Thiago Rondon, <firstname.lastname@example.org>