Last active
August 23, 2019 18:39
-
-
Save sammy8806/d50af6164061b72211ed6b255bf78566 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Contributed by: Steven Tappert <[email protected]> | |
. "$SUBR_DIR/ip" | |
WgConfig=("${WgConfig}") | |
wireguard_up() { | |
if is_interface "$Interface"; then | |
report_error "Interface '$Interface' already exists" | |
return 1 | |
fi | |
interface_add wireguard "$Interface" | |
if ! is_interface "$Interface"; then | |
report_error "Interface '$Interface' could not be created!" | |
return 1 | |
fi | |
wg setconf "$Interface" "$WgConfig" | |
bring_interface_up "$Interface" | |
ip_set | |
} | |
wireguard_down() { | |
ip unset | |
interface_delete "$Interface" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'd suggest the following patch for better error handling: