Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for adding more clients #58

Merged
merged 2 commits into from
Apr 8, 2020
Merged

Add support for adding more clients #58

merged 2 commits into from
Apr 8, 2020

Conversation

angristan
Copy link
Owner

This commit puts the client creation logic into a function.

By running the script followed by add_client, the user will be asked a few questions and a new peer will be added.

Removing client is not supported.

The client files have random names.

Fix for #3

This commit puts the client creation logic into a function.
By running the script followed by `add_client`, the user will be asked a
few questions and a new peer will be added.
Removing client is **not** supported.
The client files have random names.

Fix for #3
@angristan angristan added the enhancement New feature or request label Mar 21, 2020
@angristan
Copy link
Owner Author

./wireguard-install.sh add_client

@angristan angristan merged commit f0891e7 into master Apr 8, 2020
Comment on lines +7 to +14
if [[ $SERVER_PUB_IP =~ .*:.* ]]
then
echo "IPv6 Detected"
ENDPOINT="[$SERVER_PUB_IP]:$SERVER_PORT"
else
echo "IPv4 Detected"
ENDPOINT="$SERVER_PUB_IP:$SERVER_PORT"
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@angristan why do we need parenthesis?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because that's how you regex match in a bash if...

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If anything changes how the variables are used to anchor them. For example ${SERVER_PUB_IP} etc

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry @AndreiG6, I meant why we need [ ] for IPv6. Line 10

If it's for escaping the : char we can use ${SERVER_PUB_IP} instead of an if case.

Copy link

@AndreiG6 AndreiG6 Jul 2, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not escaping anything, just poor concat/formating I suppose. Somewhere there's probably a split for "ipv4/6:port" format. As in whatever uses that $ENDPOINT var

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No split, just an echo to the config file, but Wireguard doesn't really need this [ ] format.
If it's safe then I will remove the if case in #92

Thanks @AndreiG6

randshell added a commit to randshell/wireguard-install that referenced this pull request Jul 2, 2020
@angristan angristan deleted the multiple-client branch July 29, 2020 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants