From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Jason@zx2c4.com Received: from krantz.zx2c4.com (localhost [127.0.0.1]) by krantz.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 6e2bfe65 for ; Sat, 14 Apr 2018 01:49:20 +0000 (UTC) Received: from frisell.zx2c4.com (frisell.zx2c4.com [192.95.5.64]) by krantz.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 12e9a5aa for ; Sat, 14 Apr 2018 01:49:20 +0000 (UTC) Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id f11b70da for ; Sat, 14 Apr 2018 01:40:29 +0000 (UTC) Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 52519dad (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128:NO) for ; Sat, 14 Apr 2018 01:40:28 +0000 (UTC) Received: by mail-ot0-f172.google.com with SMTP id o9-v6so11877319otj.5 for ; Fri, 13 Apr 2018 19:03:32 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <2598be63-11f3-1e91-a52a-f82f47274eed@sholland.org> References: <2598be63-11f3-1e91-a52a-f82f47274eed@sholland.org> From: "Jason A. Donenfeld" Date: Sat, 14 Apr 2018 04:03:31 +0200 Message-ID: Subject: Re: Android app and command line To: Samuel Holland Content-Type: text/plain; charset="UTF-8" Cc: Jacob Schooley , WireGuard mailing list List-Id: Development discussion of WireGuard List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Fri, Mar 16, 2018 at 3:38 AM, Samuel Holland wrote: > I've looked into this, and it is unfortunately quite difficult to do. The app > can register to receive notification about network changes, but unfortunately > there's no* way for the app to tell the Android connectivity service that the > WireGuard tunnel exists, so Android can track its state. Even then, wg-quick on > the command line wouldn't easily be able to tell the app about _new_ tunnels. > > *without using reflection to access internal framework classes. Maybe reflection isn't so bad a solution when considering the alternatives. But here are some other ideas: We could actually just monitor the output of `ip monitor dev wg0` or the like, and not get bogged down trying to wade through the java... If you think it's possible for the android app to register some sort of intent listening, we could make wg-quick.c broadcast it from the command line via `am broadcast`. This might be easiest to pull off. Upon receiving the broadcast, the app would then double check the status of endpoints (`wg show interfaces`) and update the statuses accordingly. Interested in implementing this?