Skip to content

Commit 792d1d1

Browse files
committed
zshrc: switch to myip.grml.org with IPv6 support, options -4 + -6 to force respective protocols
http://v4.showip.spamt.net/ is down since at least 2026-01-11: % myip <html> <head><title>502 Bad Gateway</title></head> <body> <center><h1>502 Bad Gateway</h1></center> <hr><center>nginx/1.24.0 (Ubuntu)</center> </body> </html> We decided to implement our own solution, to not leak IP addresses to any foreign services. While doing so, add support for IPv6, and also support the "-4" + "-6" command line options, to explicitly request IPv4 + IPv6 addresses. Closes: /issues/237
1 parent d841ed8 commit 792d1d1

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

etc/zsh/zshrc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3443,9 +3443,14 @@ function _simple_extract () {
34433443
compdef _simple_extract simple-extract
34443444
[[ -n "$GRML_NO_SMALL_ALIASES" ]] || alias se=simple-extract
34453445

3446-
#f5# Show "public" IPv4 address of current system on stdout. Requires network access and curl(1).
3446+
#f5# Show "public" IP address of current system on stdout. Requires network access and curl(1).
34473447
function myip () {
3448-
curl http://v4.showip.spamt.net/ -H 'User-Agent: grml-etc-core-zshrc'
3448+
if [[ $# == 0 ]] || [[ $1 == "-4" ]] || [[ $1 == "-6" ]] ; then
3449+
curl "$@" https://myip.grml.org -H 'User-Agent: grml-etc-core-zshrc'
3450+
else
3451+
printf 'usage: myip [-4|-6]\n' >&2
3452+
return 1
3453+
fi
34493454
}
34503455

34513456
#f5# Change the xterm title from within GNU-screen

0 commit comments

Comments
 (0)