Code Monkey home page Code Monkey logo

nizvpn's Introduction

NizVPN

Flutter Android VPN based on OpenVPN Library.

Let's Code!

I made it so simple to connect to OpenVPN, everything is setup, all you need to do is do the layouting on this project (i don't recommanded you to create a new project).

Here, i'll show you how to deal with the "connection things"

Do this to Connect / Disconnect

Connect or Disconnect vpn with single line of code!

    ...
        _vpnStage = NizVpn.vpnDisconnected;
        _selectedVpn = VpnConfig(
            config: "OVPN CONFIG IS HERE", 
            name: "Japan", 
            username: "VPN Username", 
            password:"VPN Password"
        );
    ...

    ...
        if (_selectedVpn == null) return; //Stop right here if user not select a vpn
        if (_vpnStage == NizVpn.vpnDisconnected) {
            //Start if stage is disconnected
            NizVpn.startVpn(_selectedVpn);
        } else {
            //Stop if stage is "not" disconnected
            NizVpn.stopVpn();
        }
    ...

Listen to VPN Stage & Status

Don't forget to listen your vpn stage and status, you can simply show them with this.

    ...
        //Add listener to update vpnStage
        NizVpn.vpnStageSnapshot().listen((event) {
            setState(() {
                _vpnStage = event; //Look at stages detail below
            });
        });
    ... 
    ...
        //Add listener to update vpnStatus
        NizVpn.vpnStatusSnapshot().listen((event){
            setState((){ 
                _vpnStatus = event;
            });
        })
    ... 

VPN Stages

Let me be clearer, VPN Stage shows the connection indicator when connecting the VPN

static const String vpnConnected = "connected";
static const String vpnDisconnected = "disconnected";
static const String vpnWaitConnection = "wait_connection";
static const String vpnAuthenticating = "authenticating";
static const String vpnReconnect = "reconnect";
static const String vpnNoConnection = "no_connection";
static const String vpnConnecting = "connecting";
static const String vpnPrepare = "prepare";
static const String vpnDenied = "denied";

Note : To change notification's icon, you can go to vpnLib/main/res/drawable and replace ic_notification.png from there!

License

This project and the uses VPN library "ICS OpenVPN" both are under GPLv2 License.

nizvpn's People

Contributors

nizwar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nizvpn's Issues

CPP files

Hello I want to know how you have converted files in the cpp folder into lib.so files I know flutter doesn't support c++ files directly can you tell me how you have done this

Build Failed

I trying to build app but showing this error

be applied to given types;
boolean useOpenVPN3 = VpnProfile.doUseOpenVPN3(this);
^
required: no arguments
found: OpenVPNService
reason: actual and formal argument lists differ in length
D:\ali\nizvpn-master\android\vpnLib\src\main\java\de\blinkt\openvpn\core\OpenVPNService.java:839: error: method doUseOpenVPN3 in class VpnProfile cannot be applied to given types;
if (!VpnProfile.doUseOpenVPN3(this))
^
required: no arguments
found: OpenVPNService
reason: actual and formal argument lists differ in length
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':vpnLib:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 29s
Exception: Gradle task assembleDebug failed with exit code 1

App closing after opening

Hello, thanks for the wonderful plugin.
I cloned your repository and made the changes and when I run it through VSCode it opens normally in the emulator.
However, when I generate the apk (flutter build apk --release) the generated apk installed in the emulator when opened is closed automatically.
The apk in debug mode (flutter build apk --debug) is the same.
But why does this happen only with the apk and when I run through vscode everything works perfectly?
The change I made to the android folder was to change the package name.

Edit:Without changing anything in the project, the same thing happens

The application closed automatically

I cloned your repository without changing anything, but when I run it with "flutter run" the application doesn't want to open and closed automatically.

I used Google Pixel 3 and Android 10 in my emulator.

Thanks in advance for any help.

How can I get the client ip?

Hi
Is there any way to get the private IP assigned to a client who connects to the OpenVPN server through .ovpn config file?

android Push notification panel VPN

Hello, I need to edit data while disconnecting VPN (via button and via push notification), but I don't know where and how to deal with push notification ?

Defective version of the OpenSSL raised by the Google Play Store

We are getting this issue raised by the Google Play Store:-


Defective OpenSSL Version
Error
Your app uses a defective version of the OpenSSL library, which can cause your app to crash. Update to a fixed version of OpenSSL.

Defective versions:

OpenSSL 1.1.1g in lib/x86_64/libopenvpn.so


Please let us know what to do to resolve this issue.

vpn notconnecting

how can i remove the notification while connecting/connected to the vpn

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.