StunServer

Stun 服务器


npm下载stun包

 

npm i stun -s

google stun服务器

google的stun的服务器一般国内访问较慢,所以一般自己搭建一个服务器

const stun = require('stun');

stun.request('stun.l.google.com:19302',(err,res)=>{
    if(err){
        console.log(err);
    }else{
        const {adress}=res.getXorAddress();
        console.log(res);
        console.log('you ip',adress);
    }
})
posted @ 2021-11-10 13:42  lyzhi  阅读(596)  评论(0编辑  收藏  举报