Skip to content

parsing breaks with IPv4-mapped IPv6 addresses #8

Open
@rogpeppe

Description

@rogpeppe

The IPv6 address syntax allows forms such as ::ffff:192.0.2.128, but the reference parsing code, despite allowing other forms of IPv6 address, doesn't seem to allow these, even though the Go net package does.

For example, running against commit 8507c7f, this code fails:

package main

import (
	"fmt"

	"github.com/distribution/reference"
)

func main() {
	_, err := reference.ParseAnyReference("[::ffff:192.0.2.128]/bar")
	if err != nil {
		fmt.Println("error:", err)
	}
}

The error it prints is:

error: invalid reference format

Although the code says "Special addresses such as IPv4-Mapped are deliberately excluded", ISTM that that exclusion is not entirely warranted, as it's reasonable to specify an address in this way. The same cannot be said of zone identifiers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions