Gnirehtet 2: our reverse tethering tool for Android now available in Rust

Gnirehtet becomes native

Several months ago, I introduced gnirehtet, a tool providing reverse tethering for Android without any root access.

Since then, I rewrote the desktop-part of the application in Rust (the original version was in Java). As a consequence, the application is native, and the Java Runtime Environment in not needed anymore.

And it’s also open source:

How to use gnirehtet 2

(Almost) the same way as gnirehtet 1.

To share your computer connection with your Android device, just download the Rust version of gnirehtet for your system, and execute:

./gnirehtet run

(adb must be installed)

A “key” logo appears in your device status bar when reverse tethering is enabled

More advanced usage, like enabling reverse tethering for several devices simultaneously, is also easy. Check the README.

How does gnirehtet 2 work?

Apart from a few details, the principle is the same as gnirehtet 1. The developers page has been updated to document the Rust version.

To get rid of the shell scripts, the command-line parsing is now directly handled by the application (both the Java and the Rust version). This allows a more consistent behavior across different platforms.

What about Rust?

Rust is a programming language developed by Mozilla Research, used among others by Servo, the next-generation browser engine for Firefox.

I didn’t know Rust at all before rewriting gnirehtet. It provides many cool features:

  • zero-cost abstractions
  • move semantics
  • guaranteed memory safety
  • threads without data races
  • trait-based generics
  • pattern matching
  • type inference
  • minimal runtime
  • efficient C bindings

I detailed my experience with Rust and the problems I faced during this rewriting on my personal blog:

Gnirehtet rewritten in Rust

Conclusion

Learning Rust was a rewarding experience to me, and I’m glad that Gnirehtet is now a native application.

If you encounter any problem with it, please submit an issue.

Happy reverse tethering!

Find Genymobile on Twitter, Facebook and Google+