rc: fallback to curl with myip

Closes #80

Possibly broken somehow.
This commit is contained in:
Aminda Suomalainen 2015-07-31 18:07:54 +03:00
parent 93d775c3a5
commit 198f311303
2 changed files with 38 additions and 6 deletions

View File

@ -376,9 +376,7 @@ alias gpg-key-count="gpg --export -a|gpg --import"
alias follow="tail -F"
#myip shows current IP. This was a function.
alias myip4="dig +short myip.opendns.com. A @208.67.222.222"
alias myip6="dig +short myip.opendns.com. AAAA @2620:0:ccc::2"
# Current IPv4 and IPv6 addresses. Calls functions.
alias myip="myip4 && myip6"
# Update groups without logging out. Requires entering password. Source: http://blog.edwards-research.com/2010/10/linux-refresh-group-membership-without-logging-out/
@ -926,6 +924,24 @@ mtrp() {
mtrp6 $@
}
# My IPv4 address
myip4 () {
if hash dig 2>/dev/null; then
dig +short myip.opendns.com. A @208.67.222.222
else
curl -L4s http://icanhazip.com/
fi
}
# My IPv6 address
myip6 () {
if hash dig 2>/dev/null; then
dig +short myip.opendns.com. AAAA @2620:0:ccc::2
else
curl -L6s http://icanhazip.com/
fi
}
# .custom
if [ -f ~/.custom ]; then
source ~/.custom

View File

@ -359,9 +359,7 @@ alias gpg-key-count="gpg --export -a|gpg --import"
alias follow="tail -F"
#myip shows current IP. This was a function.
alias myip4="dig +short myip.opendns.com. A @208.67.222.222"
alias myip6="dig +short myip.opendns.com. AAAA @2620:0:ccc::2"
# Current IPv4 and IPv6 addresses. Calls functions.
alias myip="myip4 && myip6"
# Update groups without logging out. Requires entering password. Source: http://blog.edwards-research.com/2010/10/linux-refresh-group-membership-without-logging-out/
@ -916,6 +914,24 @@ mtrp() {
mtrp6 $@
}
# My IPv4 address
myip4 () {
if hash dig 2>/dev/null; then
dig +short myip.opendns.com. A @208.67.222.222
else
curl -L4s http://icanhazip.com/
fi
}
# My IPv6 address
myip6 () {
if hash dig 2>/dev/null; then
dig +short myip.opendns.com. AAAA @2620:0:ccc::2
else
curl -L6s http://icanhazip.com/
fi
}
# Source files for miscannellious modifications.
# .custom