Socket.IO via tor node.js - node.js

Suppose I have 2 servers. I want to establish a connection between them using socket.io library, and one of them would reach another by .onion link using SOCKS proxy. all the traffic between servers should also go through tor.
I was able to create a simple net socket using onion links, but cannot find how to pass it to socket.io. Is it possible to make socket.io using existing net socket? or maybe there is another way to achieve the ultimate goal?

I have some working experiences with socket.io, but not with the other technologies you mention (so I can't resolve your question entirely). Until someone else resolves it, I will show you a link with about the two modules socket.io-redis and socket.io-emitter that allow socket.io to communicate with the "outside world":
https://socket.io/docs/rooms-and-namespaces/#sending-messages-from-the-outside-world

Related

beginner webrtc/nodejs issue connecting remote clients

I'm trying to develop a web application in nodejs. I'm using an npm package called "simple-peer" but i don't think this issue is related to that. I was able to use this package and get it working when integrating it with a laravel application using an apache server as the back end. I could access the host machine through it's IP:PORT on the network and connect a separate client to the host successfully with a peer-to-peer connection. However, I'm now trying to develop this specifically in node without an apache back end. I have my express server up and running on port 3000, I can access the index page from a remote client on the same network through IP:3000. But when I try to connect through webrtc, I get a "Connection failed" error. If I connect two different browser instances on the same localhost device, the connection succeeds.
For reference: i'm just using the copy/pasted code from this usage demo. I have the "simplepeer.min.js" included and referenced in the correct directory.
So my main questions are: is there a setting or some webRTC protocol that could be blocking the remote clients from connecting? What would I need to change to meet this requirement? Why would it work in a laravel/webpack app with apache and not with express?
If your remote clients can not get icecandidates, you need TURN server.
When WebRTC Peer behind NAT, firewall or using Cellular Network(like smartphone), P2P Connection will fail.
At that time, for fallback, TURN server will work as a relay server.
I recommend coTURN.
Here is an simple implementation of simple-peer with nodejs backend for multi-user video/audio chat. You can find the client code in /public/js/main.js. Github Project and the Demo.
And just like #JinhoJang said. You do need a turn server to pass the information. Here is a list of public stun/turn servers.

Peer to peer connection on LAN using Node js

I'm working on a data sharing app using node js, the idea is to create an application that can connect peers using node-js without using any kind of central dependency i.e a signalling server or something of its kind. After a lot of research I'm always back to this diagram but it only makes sense if there is no signalling server I'm targeting LAN networks so that I don't have to deal with NAT.
To be specific, I would like some to answer these specific question
Is it possible to connect to webrtc on LAN, i.e the webrtc connection will connect using my client's ip
Is it possible to use websockets without a central server, or something like websockets
Is it possible to connect two clients on LAN using node js without using any hardcoded Ips or asking users to enter ip.
Since you are using node.js, you can very well use raw UDP (dgram) and use UDP broadcasting for device discovery - then you do not need any form of centralization required by websockets/webRTC.
The answer to all your questions is Yes!
Also, there is a lof WebRTC server that you can use them on a simple Linux box, like Janus, Kurento, etc. I've tested them and they have worked with some mischief, lol. So, run it and next read their API to exchange anything you want on their medium.
I'm not sure about Janus but the Kurento has a nodeJS client itself. Read the Local Installation and JavaScript Kurento Client.
Additionally, if you want to make a WebSocket connection, it has enabled by default configuration.
To change the port, enter this command at the final step:
npm start -- --ws_uri=ws://https://185.164.72.144/:8888/kurento --as_uri=https://185.164.72.144:6008/

Is there a way to switch the connection to another TCP server?

I have made my personal project using WebSocket.
I already know that WebSocket will not connect directly raw TCP Socket.
so, I have thought what if I connect, at first, to Web Server(NodeJS) and then switch to TCP server.
is It possible to switch connection to another server using NodeJS?
If so.
Please let me happy.. Thank you! have a nice day.
I would assume it might be both possible and straightforward to tunnel/proxy TCP traffic. The high level design would be:
Start up a web server with integrated websocket server (use socket.io, really)
When a client makes a websocket connection, create an upstream TCP connection to your target server
Then do full bidirectional piping of messages between the browser<->node socket and the node<->otherServer socket
Devil might be in the details. I haven't tried, but seems feasible.
There's a node project called ws-tcp-bridge as well as a python project that claim to do this already. Neither luke terribly mature, but they might just work or at least provide good reference material.

WebSockets Servers

If I have found tutorials about WebSockets, they have only been how to create Client-Side sockets. How can I create WebSocket servers and where can I get information about this (something like in Node.js)?
I don't need done Libraries for WebSockets, I need learn how to create WebSockets Servers without Libraries for WebSockets.
Thanks for replies anyone!
https://github.com/joyent/node/wiki/modules#ws-ajax
For example this "tutorial" shows a low level WebSocket server, however it would be maybe better to look at source codes of other popular servers like node-websocket-server or specific part of socket.io which deals with the WebSocket transport.
Or you can use an already-made WebSocket server. Like https://socketsbay.com/

XMPPHP Could not connect after timeout

I am trying to create a web based PHP application which can allow chat to my Gmail friends. Something like meebo.com. I downloaded XMPPHP, and executed on localhost, and it is working fine, but when I uploaded everything to Yahoo Small business web hosting, it is throwing connection timeout error.
Do anyone else faced such problem. I heard many of them did, but no one have any solution yet.
Any suggestion will be very helpful. I am new to XMPP clients.
Just some ideas...
How are you trying to connect to the XMPP server? With XMPPHP you may use two classes which are
XMPPHP
XMPPHP_BOSH
You might try both, since they work on different ports (XMPPHP for example on 5222 and XMPPHP_BOSH on 80). So if this is a port issue, trying XMPPHP_BOSH would be an idea. You will need to find out though if this is supported by the XMPP server you are trying to connect to. And if so, you need to know the url the server exposes the BOSH service on.
Anyways, I would recommend to check out what kind of 'restrictions' there are in Yahoo Small business web hosting and on the side of the XMPP server.
If you intend to check XMPPHP_BOSH out, consider this issue to make it work: Issue 47: Http-bind error. All in all XMPPHP seems very buggy and incomplete...

Resources