code: func readAddrSpec(r io.Reader) (*AddrSpec, error) {
  	d := &AddrSpec{}
  
  	// Get the address type
  	addrType := []byte{0}
  	if _, err := r.Read(addrType); err != nil {
  		return nil, err
  	}
  
  	// Handle on a per type basis
  	switch addrType[0] {
  	case ipv4Address:
  		addr := make([]byte, 4)
  		if _, err := io.ReadAtLeast(r, addr, len(addr)); err != nil {
  			return nil, err
  		}
  		d.IP = net.IP(addr)
  
  	case ipv6Address:
  		addr := make([]byte, 16)
  		if _, err := io.ReadAtLeast(r, addr, len(addr)); err != nil {
  			return nil, err
  		}
  		d.IP = net.IP(addr)
  
  	case fqdnAddress:
  		if _, err := r.Read(addrType); err != nil {
  			return nil, err
  		}
  		addrLen := int(addrType[0])
  		fqdn := make([]byte, addrLen)
  		if _, err := io.ReadAtLeast(r, fqdn, addrLen); err != nil {
  			return nil, err
  		}
  		d.FQDN = string(fqdn)
  
  	default:
  		return nil, unrecognizedAddrType
  	}
  
  	// Read the port
  	port := []byte{0, 0}
  	if _, err := io.ReadAtLeast(r, port, 2); err != nil {
  		return nil, err
  	}
  	d.Port = (int(port[0]) << 8) | int(port[1])
  
  	return d, nil
  }
docs: // readAddrSpec is used to read AddrSpec.
  // Expects an address type byte, follwed by the address and port