Closed hosseinkhojany closed 1 year ago
Hi @hosseinkhojany! Invisible Man TUN needs administrator privilege to work properly. So, to run the service without opening a new terminal, you need to run your program as administrator. Also, can you show me how you make a socket connection between your app and tun service?
Honestly, my program in Flutter(dart) connects to TUN socket
dart await Socket.connect("127.0.0.2", 2223, sourcePort: 2223); String command = "-command=enable -device=zVPN -proxy=127.0.0.1:10801 -address=10.0.236.10 -server=${selectedVpnService .config?.vlessConfig != null ? selectedVpnService.config! .vlessConfig!.add! : selectedVpnService.config!.vmessConfig! .add} -dns=8.8.8.8"; print(selectedVpnService .config?.vlessConfig != null ? selectedVpnService.config! .vlessConfig!.add! : selectedVpnService.config!.vmessConfig! .add!); String delimiter = '<EOF>'; String message = command + delimiter; List<int> bytes = utf8.encode(message); socket?.add(bytes);
Also I have customized the socket address to 127.0.0.2
How to find the correct -gateway parameter ?
netsh interface ip set address name="wintun" source=static addr=192.168.123.1 mask=255.255.255.0 gateway=none
route add 0.0.0.0 mask 0.0.0.0 192.168.123.1
route add myserverip mask 255.255.255.255 ?gateway?
@hosseinkhojany You need to find the default gateway based on the address that you set on your wintun
adapter. There are many ways to find the network's default gateway. You can write a code to find it automatically or enter the gateway manually.
In Windows, you can find the default gateway automatically by using iphlpapi.dll
. In Invisible Man TUN, I wrote a code to find the default gateway. See these files:
Also, see this comment: tun2socks - Proper example on Windows 10
When I run invisibleman-tun.exe -port=2223 into cmd, a new terminal is opened. Is it possible to continue working in the background without opening a new terminal? I already tried to do this in C++ with CreateProcess but the socket is always off here is my cpp code:
this code done without error but socket not working