-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from roberttoups/0.5.0
0.5.0
- Loading branch information
Showing
10 changed files
with
266 additions
and
14 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
external help file: IPv4Toolbox-help.xml | ||
Module Name: IPv4Toolbox | ||
online version: http://www.github.com/roberttoups/IPv4Toolbox | ||
schema: 2.0.0 | ||
--- | ||
|
||
# Get-MyPublicIP | ||
|
||
## SYNOPSIS | ||
Returns the Public IPv4 Address of the client returned by a web API. | ||
|
||
## SYNTAX | ||
|
||
``` | ||
Get-MyPublicIP [[-Uri] <String>] [<CommonParameters>] | ||
``` | ||
|
||
## DESCRIPTION | ||
Returns the Public IPv4 Address of the client returned by a web API. | ||
|
||
## EXAMPLES | ||
|
||
### -------------------------- EXAMPLE 1 -------------------------- | ||
|
||
```powershell | ||
Get-MyPublicIP | ||
8.8.8.8 | ||
``` | ||
|
||
### -------------------------- EXAMPLE 2 -------------------------- | ||
|
||
```powershell | ||
Get-MyPublicIP -Uri 'http://icanhazip.com' | ||
8.8.8.8 | ||
``` | ||
|
||
## PARAMETERS | ||
|
||
### -Uri | ||
This is the URI used to query the Public IPv4 Address. | ||
Valid URIs are http://icanhazip.com, http://ident.me, http://ifconfig.me/ip, & http://ipinfo.io/ip. | ||
|
||
```yaml | ||
Type: System.String | ||
Parameter Sets: (All) | ||
Aliases: | ||
|
||
Required: False | ||
Position: 1 | ||
Default value: Http://ipinfo.io/ip | ||
Accept pipeline input: False | ||
Accept wildcard characters: False | ||
``` | ||
### CommonParameters | ||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). | ||
## INPUTS | ||
## OUTPUTS | ||
### System.String | ||
## NOTES | ||
This function depends on the traffic reaching the web based API not flowing through a proxy for most accurate results. | ||
## RELATED LINKS | ||
[http://www.github.com/roberttoups/IPv4Toolbox](http://www.github.com/roberttoups/IPv4Toolbox) | ||
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
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,62 @@ | ||
<# | ||
.SYNOPSIS | ||
Returns the Public IPv4 Address of the client returned by a web API. | ||
.DESCRIPTION | ||
Returns the Public IPv4 Address of the client returned by a web API. | ||
.PARAMETER Uri | ||
This is the URI used to query the Public IPv4 Address. Valid URIs are http://icanhazip.com, http://ident.me, http://ifconfig.me/ip, & http://ipinfo.io/ip. | ||
.EXAMPLE | ||
Get-MyPublicIP | ||
8.8.8.8 | ||
.EXAMPLE | ||
Get-MyPublicIP -Uri 'http://icanhazip.com' | ||
8.8.8.8 | ||
.NOTES | ||
This function depends on the traffic reaching the web based API not flowing through a proxy for most accurate results. | ||
.LINK | ||
http://www.github.com/roberttoups/IPv4Toolbox | ||
#> | ||
function Get-MyPublicIP { | ||
[CmdletBinding()] | ||
[OutputType([String])] | ||
param ( | ||
# The thing you want the single string for. | ||
[Parameter( | ||
Position = 0, | ||
Mandatory = $false, | ||
HelpMessage = 'The URI of the API Service.' | ||
)] | ||
[ValidateSet( | ||
'http://icanhazip.com', | ||
'http://ident.me', | ||
'http://ifconfig.me/ip', | ||
'http://ipinfo.io/ip' | ||
)] | ||
[String] | ||
$Uri = 'http://ipinfo.io/ip' | ||
) | ||
begin {} | ||
|
||
process { | ||
((Invoke-WebRequest -Uri $Uri).Content).Trim() | ||
} | ||
|
||
end {} | ||
} |
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
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