-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor interface stream/socket handling #460
Comments
Relation: #458 |
Couple of things to be noted:
How could be a "alive check" implemented without anything mentioned above?
|
{
"type": "request",
"uuid": "cf459c67-2f23-41a9-b9f5-70096114fdda",
"interface": "6647482a09095ddc6a03fc47"
"device": "66474820ad108d95b47b2481",
"protocol": "tcp|udp|raw|icmp",
"ping" true
} This object is forwarded to all connectors via websocket on a endpoint (e.g. If so, the connector creates a websocket briddge between the interface and the corresponding underlaying networksocket, with a query string arguments This websocket connection is then transformed into a stream, which is passed through the adapter stack configured. The properties "protocol" & "ping" are set to create a icmp ping request to the host/ip address set on the interface. The described mechanism above is just a draft and need do be fine tuned. |
Add a handshake/signing method, that no one can hijack the connection request/attempt? const crypto = require("crypto");
const SECRET = "S3c4et";
const challenge = crypto.randomBytes(16).toString('hex');
// server
const expectedHash = crypto.createHash('sha256').update(challenge + SECRET).digest('hex');
// client
const hash = crypto.createHash('sha256').update(challenge + SECRET).digest('hex');
if (receivedHash === expectedHash) {
console.log('Client authorized.');
} else {
console.log('Client auth error');
} Use something in combination like the auth token as secret? |
Some modification of class.interface.js stream/bridge handling. solution-works-no-2.txt |
The initial idea/current interface implementation is garbage.
There needs to be a way to open multiple sockets to a device.
interface.createSocket()
tells the connector to create a bridge between the device interface (e.g.tcp://192.168.122.53:8123
) and the interface websocket endpoint.This connections is then converted into a stream, which is returned by
.createSocket()
. (Maybe rename the function)For this, there needs a "management" websocket connections, just like the current
/api/events
one. Overt that connection the connector is told, "bridge from A to B" as described above.The text was updated successfully, but these errors were encountered: