zaneschepke / wgtunnel

An alternative Android client app for WireGuard VPN
https://zaneschepke.com/wgtunnel-docs
MIT License
808 stars 45 forks source link

Auto start not working,of you use Add Amnezia side-by-side with WireGuard #192

Open tomtomclub opened 5 months ago

tomtomclub commented 5 months ago

Describe the bug A clear and concise description of what the bug is.

Smartphone (please complete the following information):

To Reproduce Steps to reproduce the behavior:

  1. Go to Add Amnezia side-by-side with WireGuard
  2. Click on '....'
  3. Scroll down to auto starten'
  4. Reboot and is not common on

Expected behavior A clear and concise description of what you expected to happen.

Screenshots (Only if necessary)

Additional context Add any other context about the problem here.

zaneschepke commented 5 months ago

Hello! Can you describe more what is happening? There are some comments from other users in #149 about some values that may need to be switched around.

tomtomclub commented 5 months ago

Okay, I'm going to adjust some parameters and see what happens

tomtomclub commented 5 months ago

It Works on mobile, not on nvidia shield, I'll test it thoroughly, don't worry

GrumpyGiuseppe commented 4 months ago

There is a bug in the wg tunnel amnezia config. I tested it only with my standard wg server and changed server config.

This is my amnezia config: Jc = 100 Jmin = 10 Jmax = 1000 S1 = 0 S2 = 0 H1 = 1 H2 = 2 H3 = 3 H4 = 4

And this is what it looks like in wg tunnel: Jc = 100 Jmin = 10 Jmax = 1000 H1 = 1 H2 = 2 H3 = 3 H4 = 4

I guess it doesn't like 0 as input, but without there can't be a connection.

zaneschepke commented 4 months ago

Thanks for reporting this. I'll look into it!

zaneschepke commented 4 months ago

This is confusing. The problem lies in Amnezia's lib where they are setting the value to empty if it is equal to zero.

public Builder setInitPacketJunkSize(final int initPacketJunkSize) throws BadConfigException {
            if (initPacketJunkSize < 0)
                throw new BadConfigException(Section.INTERFACE, Location.INIT_PACKET_JUNK_SIZE,
                        Reason.INVALID_VALUE, String.valueOf(initPacketJunkSize));
            this.initPacketJunkSize = initPacketJunkSize == 0 ? Optional.empty() : Optional.of(initPacketJunkSize);
            return this;
        }

        public Builder setResponsePacketJunkSize(final int responsePacketJunkSize) throws BadConfigException {
            if (responsePacketJunkSize < 0)
                throw new BadConfigException(Section.INTERFACE, Location.RESPONSE_PACKET_JUNK_SIZE,
                        Reason.INVALID_VALUE, String.valueOf(responsePacketJunkSize));
            this.responsePacketJunkSize = responsePacketJunkSize == 0 ? Optional.empty() : Optional.of(responsePacketJunkSize);
            return this;
        }

I can easily change this in my fork, but I'm wondering if this is a bug or is the desired behavior by Amnezia.

GrumpyGiuseppe commented 4 months ago

If you look at their post here: https://www.reddit.com/r/AmneziaVPN/comments/1c1gsvz/amneziawg_app_for_ios_and_android/ They say: 'Any change of S and H parameters to different from what we have written will not allow you to correctly use "obfuscation".' If I get this right, S = 0 is necessary. The only thing I also did was adding these values to my server. That was probably the reason that the entire connection could not be established.

I don't think this is a bug. I used your amnezia config mode with amnezia backend, but this solution should also work with the official wg app. So in theory if I use wg tunnel without anything amnezia related and just add the values to the config it should work. But I am not sure if wg tunnel really use these amnezia values then. (does it?) My thought is, if I also add these values to the server they are necessary so I get a sign if the clients config is wrong. But I am also not sure about this.

So in conclusion the best solution would be to just add an option to add the values to the regular wg config.

zaneschepke commented 4 months ago

If you look at their post here: https://www.reddit.com/r/AmneziaVPN/comments/1c1gsvz/amneziawg_app_for_ios_and_android/ They say: 'Any change of S and H parameters to different from what we have written will not allow you to correctly use "obfuscation".' If I get this right, S = 0 is necessary. The only thing I also did was adding these values to my server. That was probably the reason that the entire connection could not be established.

I don't think this is a bug. I used your amnezia config mode with amnezia backend, but this solution should also work with the official wg app. So in theory if I use wg tunnel without anything amnezia related and just add the values to the config it should work. But I am not sure if wg tunnel really use these amnezia values then. (does it?) My thought is, if I also add these values to the server they are necessary so I get a sign if the clients config is wrong. But I am also not sure about this.

So in conclusion the best solution would be to just add an option to add the values to the regular wg config.

I will have to change Amnezia's code to allow for the value zero. This must be a bug in their code.