Exercise: Stringers

Make IPAddr implement fmt.Stringer so it prints as a dotted quad.

For instance, IPAddr{1, 2, 3, 4} should print as "1.2.3.4".

Add a String() string method to IPAddr, then run the code to verify the output looks right.

package main

import "fmt"

type IPAddr [4]byte

// TODO: Add a "String() string" method to IPAddr.

func main() {
	hosts := map[string]IPAddr{
		"loopback":  {127, 0, 0, 1},
		"googleDNS": {8, 8, 8, 8},
	}
	for name, ip := range hosts {
		fmt.Printf("%v: %v\n", name, ip)
	}
}