Giter VIP home page Giter VIP logo

Comments (9)

github-actions avatar github-actions commented on August 30, 2024

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

from docker-wireguard.

aptalca avatar aptalca commented on August 30, 2024

No idea what that .env is meant to accomplish but the variable is explained here: https://github.com/linuxserver/docker-wireguard?tab=readme-ov-file#site-to-site-vpn

from docker-wireguard.

thalesmaoa avatar thalesmaoa commented on August 30, 2024

Sure, this is a feature request.

The .env file is supported by docker to add enviromental variables during docker deploy. Docker .env doc.

For now, to make a site-to-site, there must be individuals calls for each client:

SERVER_ALLOWEDIPS_PEER_laptop="192.168.1.0/24,192.168.2.0/24"
SERVER_ALLOWEDIPS_PEER_smartphone="192.168.1.0/24,192.168.3.0/24"
SERVER_ALLOWEDIPS_PEER_desktop="192.168.1.0/24,192.168.4.0/24"

For 3 clients, this is ok to admin. When this number grows a bit, it is kind of difficult to track.

My suggestion is to make like peer declaration, by comma separated.

PEERS_CLIENT="laptop,smartphone,desktop"

The problem is that subnets are comma separated.

SERVER_ALLOWEDIPS=SERVER_ALLOWEDIPS_PEER_${i}

Is is possible to reimplement this line to identify different clients with dot-comma?

In other words, map like peers:

mapfile -t PEERS_ARRAY < <(seq 1 "${PEERS}")

from docker-wireguard.

aptalca avatar aptalca commented on August 30, 2024

so instead of setting

SERVER_ALLOWEDIPS_PEER_laptop="192.168.1.0/24,192.168.2.0/24"
SERVER_ALLOWEDIPS_PEER_smartphone="192.168.1.0/24,192.168.3.0/24"
SERVER_ALLOWEDIPS_PEER_desktop="192.168.1.0/24,192.168.4.0/24"

you want to set

SERVER_ALLOWEDIPS='laptop="192.168.1.0/24,192.168.2.0/24",smartphone="192.168.1.0/24,192.168.3.0/24",desktop="192.168.1.0/24,192.168.4.0/24"'

?
that barely saves any keystrokes, and the ones saved are all copy/pasteable. It would add a significant complication to the algorithm for virtually no gain.

from docker-wireguard.

drizuid avatar drizuid commented on August 30, 2024

IMHO this FR would only add complexity that we have to support. I am not in favor.

from docker-wireguard.

thalesmaoa avatar thalesmaoa commented on August 30, 2024

My suggestion is to keep the original var, but remap it as an array breaking by substring.

I will try to make some code for suggestions to clarify.

from docker-wireguard.

thalesmaoa avatar thalesmaoa commented on August 30, 2024

As an example:

I just want to merge all SERVER_ALLOWEDIPS_PEER_ in one variable as follows:

PEER_ALLOWEDIP="SERVER_ALLOWEDIPS_PEER_client1=10.254.1.0/24,SERVER_ALLOWEDIPS_PEER_client2=101.54.13.0/24,SERVER_ALLOWEDIPS_PEER_client3=110.254.11.0/24"
$ echo $PEER_ALLOWEDIP
SERVER_ALLOWEDIPS_PEER_client1=10.254.1.0/24,SERVER_ALLOWEDIPS_PEER_client2=101.54.13.0/24,SERVER_ALLOWEDIPS_PEER_client3=110.254.11.0/24

Now, I just need to extract the corresponding peer information:

PEER="client1"
substring=$(echo "$PEER_ALLOWEDIP" | grep -o "\bSERVER_ALLOWEDIPS_PEER_${PEER}=[^,]*")
echo "Substring for $PEER: $substring"
Substring for client1: SERVER_ALLOWEDIPS_PEER_client1=10.254.1.0/24

SERVER_ALLOWEDIPS in

SERVER_ALLOWEDIPS=SERVER_ALLOWEDIPS_PEER_${i}

can be replaced by substring.

Of course my code is not good and is just to present a point.

If the variable is not defined, it looks for this new pattern, take the substring and change nothing else.

from docker-wireguard.

aptalca avatar aptalca commented on August 30, 2024

The way you describe it actually doesn't even save any keystrokes. I see no benefit to this, but a bunch of risk and development cost.

Plus, your suggestion would break if you try to add multiple comma separated ranges for a single peer.

Anyway, this is not something we will add due to high cost to benefit ratio.

from docker-wireguard.

thalesmaoa avatar thalesmaoa commented on August 30, 2024

Sure, thx anyway. I will try to find another way to fix my problem.

from docker-wireguard.

Related Issues (20)

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.