<reponame>lelik004/DRF_TODO<filename>TODOnotes/node_modules/npx/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/socks-proxy-agent/node_modules/socks/examples/connect.js<gh_stars>0var Socks = require('../index.js');

var options = {
    proxy: {
        ipaddress: "172.16.58.3",
        port: 1081,
        type: 5  // (4 or 5)
    },

    target: {
        host: "172.16.58.3", // (google.com)
        port: 80
    }
};

Socks.createConnection(options, function (err, socket, info) {
    if (err)
        console.log(err);
    else {
        console.log("Connected");

        socket.on('data', function (data) {
            // do something with incoming data
        });

        // Please remember that sockets need to be resumed before any data will come in.
        socket.resume();

        // We can do whatever we want with the socket now.
    }
});