-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(net): add option -x to unshare network (#130)
* feat(net): add option -x to unshare network * feat(net): add test * feat(net): add docs and autocomplete --------- Co-authored-by: Michael Greenberg <[email protected]>
- Loading branch information
Showing
4 changed files
with
28 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
|
||
TRY_TOP="${TRY_TOP:-$(git rev-parse --show-toplevel --show-superproject-working-tree)}" | ||
TRY="$TRY_TOP/try" | ||
|
||
# Test if network works normally | ||
# using curl due to #131 (1.1 expands to 1.0.0.1) | ||
"$TRY" curl 1.1 || return 1 | ||
|
||
# Test if curl fails when network is unshared | ||
# curl exit code 7 means Failed to connect to host. | ||
"$TRY" -x curl 1.1 | ||
if [ $? -eq 7 ] | ||
then | ||
return 0 | ||
else | ||
return 1 | ||
fi |
This file contains 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