-
Notifications
You must be signed in to change notification settings - Fork 588
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
Auto stop gnirehtet app when disconnected #51
Comments
@Biswa96 The app on the Android device continues running. The notification item (whatever the technical Android term for this would be) reads "Disconnected from the relay server" and displays a "STOP GNIREHTET" button. |
The rationale is that a user may use gnirehtet to connect to the trusted desktop network, and don't want to leak data if it switches back automatically to mobile network. That's why I wanted this action to be manual. (In practice, we detect the socket disconnection, not the cable unplug.) However, we might consider adding an option to get the behavior you request, something like:
|
OK, I see. Having the -d parameter would work perfect for me! Except that -d is already taken - to override thedefault DNS server. I haven't looked at the sources yet, and I'm sure you'd be able to implement this feature in 15 minutes, but if you'd prefer a pull request, do let me know. I guess this would involve changes to all 3 projects:
|
Ahah, I managed to get a name conflict with only 2 parameters 😆.
If you're motivated, please do :) (start on the If you want to implement only the java or only the rust part, I'll take care of the other if necessary.
Correct 👍 |
@twoi Do you still consider implementing the option? |
adb start -d # disable on disconnect |
For now, never, it's not implemented. |
I use gnirehtet when I have wired network on my notebook but only unreliable wifi and/or mobile data connection. I definitely want those connection methods used when I unplug my phone (better have unreliable connection than none at all, and the connection might be better at the place I move my phone to after unplugging). But currently I always have to unlock my phone to stop gnirehtet. There definitely should be an option to stop the app automatically. |
I'm ok with that.
I don't know, but IMO it should have the "safe" behavior by default. As an explicit option, it's ok. |
I'll probably add an option when I have some time, but meanwhile you can just apply this change: diff --git a/app/src/main/java/com/genymobile/gnirehtet/GnirehtetService.java b/app/src/main/java/com/genymobile/gnirehtet/GnirehtetService.java
index 7e8b716..70732cc 100644
--- a/app/src/main/java/com/genymobile/gnirehtet/GnirehtetService.java
+++ b/app/src/main/java/com/genymobile/gnirehtet/GnirehtetService.java
@@ -224,7 +224,7 @@ public class GnirehtetService extends VpnService {
break;
case RelayTunnelListener.MSG_RELAY_TUNNEL_DISCONNECTED:
Log.d(TAG, "Relay tunnel disconnected");
- vpnService.notifier.setFailure(true);
+ vpnService.stop(vpnService);
break;
default:
} |
Can someone tell me, how i get this change into the app? Thank you very much |
Hello I compiled the app with the above mentioned changes ans it worked fine so far - up to Android 9. I bought a new Samsung Android 10 device and now the app does not exit automatically. Is there a solution for that? Thank you! |
Hi How can I use this if I can't compile this special feature but want to use it nevertheless? Can anyone release a version 2.6 with this addition please? |
In #49, we managed to come up with a script that automatically reestablishes the connection - which is great.
Now I also have a usb wired ethernet device, that I use alternatively with this reverse tethering solution. However, when the gnirehtet app is running on the device - and it stays running after pulling the plug - I cannot use the wired ethernet device until I stop gnirehtet. Then ethernet works, and when I switch back to reverse tethering, that works as well, as #49 restarts the app on the device.
So all I seem to need now to be 100% happy with this great tool, is the app to auto-stop when the usb cable is disconnected. Does it make sense to keep it running after unplugging in the first place? Because unplugging and replugging does not do the trick even when the app is running - hence the need for the script in #49 - and #49 does not require the app to stay running either. So unless there are scenarios I am not aware off, the gnirethet app should auto stop by default.
The text was updated successfully, but these errors were encountered: