Skip to content

Instantly share code, notes, and snippets.

@Oldes
Created April 10, 2022 12:57
Show Gist options
  • Save Oldes/c119655b59b30cf431d51f589961ded1 to your computer and use it in GitHub Desktop.
Save Oldes/c119655b59b30cf431d51f589961ded1 to your computer and use it in GitHub Desktop.
Resolve external IP address
Rebol []
my-ip?: function[
"Resolves external IP address"
][
quiet: system/options/quiet
system/options/quiet: true
host-name: read dns://
local-ip: read join dns:// host-name
external-ip: read http://ifconfig.me/ip
system/options/quiet: quiet
sys/log/info 'REBOL ["Host-name: ^[[m" host-name]
sys/log/info 'REBOL ["Local-ip: ^[[m" local-ip]
sys/log/info 'REBOL ["External-ip:^[[m" external-ip]
external-ip
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment