Electron js offline network with pouchdb - networking

I've created an electronjs app with pouchdb. The intent of this desktop app is to work within a wireless network of tablet application that share the same data that is pretty much blocked from the internet 95% of the time (hence the pouchdb implementation). In order for the tablet applications to sync with the desktop app, they need to be aware of how to connect to the desktop app within the network. My initial thought would be to broadcast the IP address of the electron js app in order to share data within pouchdb, but I'm not sure if it's possible. I am also thinking that I'll could install couchdb as a separate instance on the network, but would like to keep set up as simple as possible. Any ideas on how I can set this up with electron js and pouchdb?

You might be able to achieve the desired result using the Multicast DNS discovery service with Node. With mDNS, you can query the local network for other devices broadcasting on a specific namespace (e.g. 'myappid.local') which the application could query the network for.
multicast-dns is a module capable of querying the network for other devices broadcasting under a name and getting their local IP address.
After establishing a connection to other application instances on the same network, you could try replicating the database over that connection. A PouchDB plugin might be required for getting this data from Electron's main process to the renderer.

Related

Serial COM port data over WebRTC

I'm currently looking at options to allow me to build a remote COM-port solution.
The idea is to be able to access from my remote PC, another PC that's directly connected to a device locally via its serial COM-port.
I know that the obivous answer is to use a VPN between the 2 Internet connected PCs.
However, I need this solution to be as seamless to the end-user as possible.
i.e. no installing and configuring VPN software, etc.
So I was thinking that WebRTC would be great because the end-user can simply use their web-browser and not have to install any additional software.
My question is, is it possible to stream the COM port data between the 2 PCs via WebRTC?
If so, can you please point me in the right direction as to how I can go about achieving this?
Sorry if this is a ridiculous question, I'm very new to WebRTC, just exploring my options.
Thanks.
That should work great!
Networking wise you get NAT Traversal. That means the two computers can be in completely different networks, and still communicate. You may have to run a TURN server if P2P isn't possible.
Data wise you can exchange anything you want via data channels. It is datagram based and you can send/receive binary data. You get a callback telling you how much has been delivered, that way you can detect backpressure.
Are you ok with installing software on the remote host? You can do something like Pion WebRTC's data-channels. This shows you can have a browser connect to a Go process via WebRTC. Then use tarm/serial on the remote host to interact with the device.
If you want a browser on both ends there is the Web Serial API I haven't used it myself though. That locks you into only doing Chromium which might be an issue.

Migrate from legacy network in GCE

Long story short - I need to use networking between projects to have separate billing for them.
I'd like to reach all the VMs in different projects from a single point that I will use for provisioning systems (let's call it coordinator node).
It looks like VPC network peering is a perfect solution to this. But unfortunately one of the existing networks is "legacy". Here's what google docs state about legacy networks.
About legacy networks
Note: Legacy networks are not recommended. Many newer GCP features are not supported in legacy networks.
OK, naturally the question arises: how do you migrate out of legacy network? Documentation does not address this topic. Is it not possible?
I have a bunch of VMs, and I'd be able to shutdown them one by one:
shutdown
change something
restart
unfortunately it does not seem possible to change network even when VM is down?
EDIT:
it has been suggested to recreate VMs keeping the same disks. I would still need a way to bridge legacy network with new VPC network to make migration fluent. Any thoughts on how to do that using GCE toolset?
One possible solution - for each VM in the legacy network:
Get VM parameters (API get method)
Delete VM without deleting PD (persistent disk)
Create VM in the new VPC network using parameters from step 1 (and existing persistent disk)
This way stop-change-start is not so different from delete-recreate-with-changes. It's possible to write a script to fully automate this (migration of a whole network). I wouldn't be surprised if someone already did that.
UDPATE
https://github.com/googleinterns/vm-network-migration tool automates the above process, plus it supports migration of a whole Instance Group or Load Balancer, etc. Check it out.

Work with multiple NICs/networks in Windows

I'm searching for a solution to work on a Windows machine with multiple NICs/networks. While working within the network of a customer I tend to get a lot of problems. I need an internet connection for several things like git/sourcesafe/development system etc. but clients often can't offer internet access. So the solution is to use a mobilephone to connect to the internet and ethernet to access the client network/database.
Windows seems to be pretty random here. Sometimes everything works, some mintues later it trys to access the internet over the clients gataway or access the database via the internet. So I end up deactivting/activating NIC's all day long.
Is there some easy way to use the ethernet connection only to access the clients network and the mobile for everything else?
From what you described I think this might help: turn off DHCP for the interface that connects to your customers network and set a static address for that (without a gateway). Then configure your other interface to use DHCP. This should set ONE default gateway (your phone) and all traffic will run through it, except endpoints in your customer's net.
BTW: You can only have one default gateway at a time, of course, but in your case the gateway that was set the latest won, so to speak.

Network Traffic Emulator

I am testing an application which monitors the traffic and identify the various hosts/machines present in the network with list of services/applications runs on them.
How will i simulate the traffic from multiple application like (Eg: Http, Https, Oracle, SQL Server, SAP etc)?
I don't think there is any type simulator doing what you have asked.
We have load testers, load balance testers etc.
But simulating all devices and technologies like SAP etc , its really difficult.
There should be an individual application each installed on the application/device which use network and does need ful

access serial port through internet which is connected to a remote machine

I have a sensor gateway which is connected to the serial port. My java program basically a desktop application which is collecting sensor data and storing in a public mysql database. Now I am wanting to access the serial port through internet with a web application which is using the same public mysql database. I have think a bit but I think it is not a proper way. If I would keep a table in the database, if any command is generated through internet via the web application this table store the command for a period of time and my desktop application continuous monitoring the table if data available get the data and pass it through serial port. I am seeking for a proper way to access serial port through internet/cloud which is connected to remote machine or something like an expert opinion.
That's certainly the simplest method. Much simpler than say a web service that stores it in memory, or again in the database and you get safety which you wouldn't get if you just relied on the file system to lock a file. You might need some method of clearing out the output from the DB.

Resources