Skip to content

Instantly share code, notes, and snippets.

@scottdware scottdware/azureip_print.go Secret
Last active Aug 29, 2015

What would you like to do?
Azure IPs printed to console
package main
import (
type AzurePublicIPAddresses struct {
Region []Region `xml:"Region"`
type Region struct {
Name string `xml:"Name,attr"`
Subnets []Subnet `xml:"IpRange"`
type Subnet struct {
Subnet string `xml:"Subnet,attr"`
func main() {
var azure AzurePublicIPAddresses
x, err := ioutil.ReadFile(os.Args[1])
if err != nil {
if err := xml.Unmarshal(x, &azure); err != nil {
for _, r := range azure.Region {
fmt.Printf("%+v\n", r.Name)
for _, s := range r.Subnets {
fmt.Printf("--> %+v\n", s.Subnet)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.