bind.js 615 B

123456789101112131415161718192021222324252627282930
  1. var Socks = require('../index.js');
  2. var options = {
  3. proxy: {
  4. ipaddress: "202.101.228.108",
  5. port: 1080,
  6. type: 5,
  7. command: 'bind'
  8. },
  9. target: {
  10. host: "0.0.0.0",
  11. port: 0
  12. }
  13. };
  14. Socks.createConnection(options, function(err, socket, info) {
  15. if (err)
  16. console.log(err);
  17. else {
  18. console.log("Connected");
  19. // BIND request completed, now a tcp client should connect to this endpoint:
  20. console.log(info);
  21. // { port: 3334, host: '202.101.228.108' }
  22. // Resume! You need to!
  23. socket.resume();
  24. }
  25. });