Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for IPv6 Addresses in ServiceAddressTrait #227

Open
jdpedrie opened this issue Feb 20, 2019 · 2 comments
Open

Add support for IPv6 Addresses in ServiceAddressTrait #227

jdpedrie opened this issue Feb 20, 2019 · 2 comments
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@jdpedrie
Copy link
Contributor

jdpedrie commented Feb 20, 2019

Currently, GAX does not support IPv6 addresses. Providing an IPv6 hostname will raise Google\ApiCore\ValidationException.

Example:

<?php

use Google\ApiCore\ServiceAddressTrait;
use Google\ApiCore\ValidationException;

include __DIR__ .'/../gax-php/vendor/autoload.php';

class TestClient
{
    use ServiceAddressTrait;

    public $hostname;

    public $port;

    public function __construct($address)
    {
        list (
            $this->hostname,
            $this->port
        ) = $this->normalizeServiceAddress($address);
    }
}

$addresses = [
    '[::1]:8080',
    '::1',
    '[2001:0db8:85a3:0000:0000:8a2e:0370:7334]:8080',
    '2001:0db8:85a3:0000:0000:8a2e:0370:7334'
];

foreach ($addresses as $address) {
    try {
        $client = new TestClient($address);
        var_dump('Success: '. $address);
    } catch (ValidationException $e) {
        var_dump('Fail: '. $e->getMessage());
    }
}

Output:

string(40) "Fail: Invalid serviceAddress: [::1]:8080"
string(33) "Fail: Invalid serviceAddress: ::1"
string(76) "Fail: Invalid serviceAddress: [2001:0db8:85a3:0000:0000:8a2e:0370:7334]:8080"
string(69) "Fail: Invalid serviceAddress: 2001:0db8:85a3:0000:0000:8a2e:0370:7334"
@jdpedrie jdpedrie added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Feb 20, 2019
@michaelbausor michaelbausor added the priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. label Mar 18, 2019
@michaelbausor
Copy link
Contributor

Thanks @jdpedrie, sorry I didn't respond until now. I marked this P1 , but wanted to check if there is a current user impact from this in google-cloud-php?

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Mar 18, 2019
@jdpedrie
Copy link
Contributor Author

No worries! Not much impact. The Firestore emulator supports both IPv6 and IPv4. We discovered the missing support when we were adding support for the emulator to Google Cloud PHP. The solution is to simply use the IPv4 address, and we informed users of that, but if someone were to use the IPv6 service address, they would encounter an error.

@yihanzhen yihanzhen removed 🚨 This issue needs some love. triage me I really want to be triaged. labels Apr 22, 2019
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Apr 22, 2019
@michaelbausor michaelbausor added priority: p2 Moderately-important priority. Fix may not be included in next release. and removed priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. labels May 23, 2019
@yoshi-automation yoshi-automation removed the 🚨 This issue needs some love. label Jun 4, 2019
@dwsupplee dwsupplee assigned jdpedrie and unassigned michaelbausor Jun 25, 2019
@jdpedrie jdpedrie removed the priority: p2 Moderately-important priority. Fix may not be included in next release. label Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants