problem description
how to intercept and proxy all (or specified) traffic from a specified process (giving priority to Windows), so that traffic from a specified program, rather than global traffic, passes through VPN.
the environmental background of the problems and what methods you have tried
there are some websites in our school that need to be linked to VPN to access, but every time we connect to VPN, the traffic of all applications will go. VPN, not only takes up the bandwidth of VPN, but also has a high delay. Therefore, want to write their own Mini Program to solve this problem, or have off-the-shelf software is also excellent.
I have tried to change the routing table, but the applicability is very poor. You have to know in advance the destination address of the traffic to pass through the VPN, and then add it to the routing table one by one. If the address is dynamic and there are a lot of addresses, it would be impractical to add them manually.
desired results
if there is no off-the-shelf software, I would like to know the relevant system call or other functions that can be implemented by myself, such as getting all connections of a process, proxy-specified connections, and forwarding data through VPN. If possible, I would like to use Node.js to implement this function.