def get_all_subdomains(offset=0, count=100, proxy=None, hostport=None):
    """
    Get all subdomains within the given range.
    Return the list of names on success
    Return {'error': ...} on failure
    """
    assert proxy or hostport, 'Need proxy or hostport'
    if proxy is None:
        proxy = connect_hostport(hostport)

    offset = int(offset)
    count = int(count)

    page_schema = {
        'type': 'object',
        'properties': {
            'names': {
                'type': 'array',
                'items': {
                    'type': 'string',
                    'uniqueItems': True
                },
            },
        },
        'required': [
            'names',
        ],
    }

    schema = json_response_schema(page_schema)

    try:
        resp = proxy.get_all_subdomains(offset, count)
        resp = json_validate(schema, resp)
        if json_is_error(resp):
            return resp

        for name in resp['names']:
            if not is_subdomain(str(name)):
                raise ValidationError('Not a valid subdomain: {}'.format(str(name)))

    except ValidationError as ve:
        if BLOCKSTACK_DEBUG:
            log.exception(ve)

        resp = {'error': 'Server response did not match expected schema.  You are likely communicating with an out-of-date Blockstack node.', 'http_status': 502}
        return resp

    except socket.timeout:
        log.error("Connection timed out")
        resp = {'error': 'Connection to remote host timed out.', 'http_status': 503}
        return resp

    except socket.error as se:
        log.error("Connection error {}".format(se.errno))
        resp = {'error': 'Connection to remote host failed.', 'http_status': 502}
        return resp

    except Exception as ee:
        if BLOCKSTACK_DEBUG:
            log.exception(ee)

        log.error("Caught exception while connecting to Blockstack node: {}".format(ee))
        resp = {'error': 'Failed to contact Blockstack node.  Try again with `--debug`.', 'http_status': 500}
        return resp

    return resp['names']
Get all subdomains within the given range.
    Return the list of names on success
    Return {'error': ...} on failure