node.js sunucum tarafından alınan trafiği TLS bağlantısına tünellemeye çalışıyorum. Sunucu konsolundaNode.js içinde TLS tüneli nasıl oluşturulur
$ curl --insecure https://myhost:443
hello world
$ curl --insecure https://localhost:7000
# nothing... just hangs
Ben Data received from client
görüyorum ama asla connect
geri arama: Ben çalıştırmak ve test zaman
function tunnel() {
var c = tls.connect(443, 'myhost', {rejectUnauthorized: false});
var server = net.createServer(function (socket) {
socket.addListener("connect", function() {
console.log("Connection from " + socket.remoteAddress);
//sync the file descriptors, so that the socket data structures are the same
c.fd = socket.fd;
//pipe the incoming data from the client directly onto the server
c.pipe(socket);
//and the response from the server back to the client
socket.pipe(c);
});
socket.addListener("data", function (data) {
console.log("Data received from client");
});
socket.addListener("close", function() {
server.close();
});
});
server.listen(7000);
}
, benim terminalde görüyoruz: Bazı Böyle kodu var .
Doğru yolda mıyım? Bir sunucunun connection
olay işleyicisi (eğer createServer()
geçmek geri arama) geçirilen