UNPKG

js2ray

Version:

The v2ray vmess protocol, based on nodejs javascript which you can use on hosts and servers

23 lines (21 loc) 598 B
function init(networks, remoteNetwork) { const data = networks[Math.floor(Math.random() * networks.length)] return function (localsocket) { localsocket.pause(); var remote = remoteNetwork( data.address, data.port, data.option, function () { localsocket.resume() }, localsocket.localMessage, localsocket.localClose ) return { message: remote.message, close: remote.close, } } } module.exports = init