Have 2 app (node.js in my case) between which I want to install an encrypted channel and exchange messages.
This almost completely solved the TLS and client authentication. For example something like this: https://gist.github.com/pcan/e384fcad2a83e3ce20f9a...
However, there is a problem:
This approach involves the creation of a server certificate that is bound to a domain name:
Specify server Common Name, like 'localhost' or 'server.localhost'. The client will verify this, so make sure you have a vaild DNS name for this.
And I would like to avoid binding conditional server in this case does not and cannot have any domain name or a static IP.
So I want to get a circuit where there are 2 host which can change IP and no domain name. And they should be able to connect to each other (the initiator of the"customer connection" can be any) something like this example:
While it is possible in advance to exchange keys / certificates.
If this is possible using TLS?
And how to adequately and safely use regular sockets and encrypt the content? (something like this https://stackoverflow.com/questions/22738754/node-...