class AdVpnThread implements Runnable, DnsPacketProxy.EventLoop {

    void configurePackages(VpnService.Builder builder, Configuration config) {
        Set<String> allowOnVpn = new HashSet<>();
        Set<String> doNotAllowOnVpn = new HashSet<>();

        config.whitelist.resolve(vpnService.getPackageManager(), allowOnVpn, doNotAllowOnVpn);

        if (config.whitelist.defaultMode == Configuration.Whitelist.DEFAULT_MODE_NOT_ON_VPN) {
            for (String app : allowOnVpn) {
                try {
                    Log.d(TAG, "configure: Allowing " + app + " to use the DNS VPN");
                    builder.addAllowedApplication(app);
                } catch (Exception e) {
                    Log.w(TAG, "configure: Cannot disallow", e);
                }
            }
        } else {
            for (String app : doNotAllowOnVpn) {
                try {
                    Log.d(TAG, "configure: Disallowing " + app + " from using the DNS VPN");
                    builder.addDisallowedApplication(app);
                } catch (Exception e) {
                    Log.w(TAG, "configure: Cannot disallow", e);
                }
            }
        }
    }

    public  AdVpnThread(VpnService vpnService, Notify notify);

}