nodertc / stun

Low-level Session Traversal Utilities for NAT (STUN) client and server
MIT License
160 stars 29 forks source link

Add support for STUN-over-TCP client #19

Closed reklatsmasters closed 5 years ago

reklatsmasters commented 5 years ago
const client = stun.connect({ type: 'tcp', host: 'stun.l.google.com', port: 19302 });
const request = stun.createMessage(STUN_BINDING_REQUEST);

client.on('error', (err) => {
    // ...
});

client.on(STUN_BINDING_RESPONSE, (response) => {
    // ...
});

client.send(request);

/// or

client.request(request, (err, response) => {
    // ...
});