It is currently May 1st, 2024, 10:25 am

IPv6 address display

Get help with creating, editing & fixing problems with skins
dapper
Posts: 10
Joined: October 7th, 2010, 4:08 am

IPv6 address display

Post by dapper »

I hope someone can help.

I'm looking to display my IPv6 WAN address along side the existing IPv4 address. I've found a few ways to find and display this information, I'm just not sure how to incorporate the data into my skin. The site I'm thinking of using is:

http://whatsmyipv6.org/

They offer a 'backend' specifically for use by applications like Rainmeter. The "backend" uses a JSON file with the following format:

Address - http://whatsmyipv6.org/backend.php
JSON - {"protocoll":"IPv6","address":"IPv6 address goes here"}

Any help would be appreciated.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: IPv6 address display

Post by jsmorley »

You could use something like this:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[MeasureIPV6]
Measure=Plugin
Plugin=WebParser
URL=http://whatsmyipv6.org/backend.php
RegExp="(?siU)(?(?=IPv6).*"address":"(.*)")"
Substitute="":"No IPv6"
FinishAction=!ShowMeter MeterIPV6
StringIndex=1

[MeterIPV6]
Meter=String
MeasureName=MeasureIPV6
FontSize=12
FontColor=255,255,255,255
AntiAlias=1
Hidden=1
What this does is use WebParser to check your IPv6 address on that site/backend. It uses a lookahead assertion to address a situation where a system does not have IPv6 enabled (still fairly common) without creating an error condition due to the regular expression failing. If the IPv6 is not found, then an empty string is returned instead, and we use a Substitute option to set to some text value.

Then when the WebParser measure is done, it "unhides" the String meter, so we only get a valid result there, and it doesn't start out with "No IPv6" when the skin is first loaded or refreshed.
User avatar
Arne Anka
Posts: 100
Joined: April 18th, 2009, 11:31 am
Location: Sweden

Re: IPv6 address display

Post by Arne Anka »

jsmorley wrote:What this does is use WebParser to check your IPv6 address on that site/backend. It uses a lookahead assertion to address a situation where a system does not have IPv6 enabled (still fairly common) without creating an error condition due to the regular expression failing.
But since this webpage returns your protocoll (IPv4 or IPv6) and the corresponding IP number, it's (IMHO) not necessary.
ip.png

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[GetCurrentIP]
Measure=Plugin
Plugin=WebParser
URL=http://whatsmyipv6.org/backend.php
RegExp="(?siU).*:"(.*)",".*:"(.*)".*
UpdateRate=900

[MeasureProtocoll]
Measure=Plugin
Plugin=WebParser.dll
Url=[GetCurrentIP]
StringIndex=1

[MeasureIP]
Measure=Plugin
Plugin=WebParser.dll
Url=[GetCurrentIP]
StringIndex=2

[MeterProtocoll]
Meter=String
MeasureName=MeasureProtocoll
X=0
Y=0
FontSize=12
FontColor=255,255,255,255
AntiAlias=1
Text="Protocoll: %1"

[MeterIP]
Meter=String
MeasureName=MeasureIP
X=r
Y=2R
FontSize=12
FontColor=255,255,255,255
AntiAlias=1
Text="Wan IP: %1"
Livet är bara en period man ska överleva.
Som filosoferna säger: man föds, man lever och man dör ensam...
dapper
Posts: 10
Joined: October 7th, 2010, 4:08 am

Re: IPv6 address display

Post by dapper »

Thank you both for the suggestions. Off to play :)