Skip to content
This repository was archived by the owner on May 25, 2023. It is now read-only.
This repository was archived by the owner on May 25, 2023. It is now read-only.

Make IPPrefix smaller? #167

@bradfitz

Description

@bradfitz

(Re-filing #154, which was closed when half of it was done)

An IPPrefix is currently an IP + a uint16, 32 bytes.

Now that IPPrefix is opaque, we can make it smaller:

We could instead do:

type IPPrefix struct {
     addr uint128
     isv6 bool
     bits uint8
}

And we'd be at 24 bytes after padding: https://play.golang.org/p/opWXptWj6jQ

This all assumes an IPPrefix of an IPv6 zone doesn't make sense. Is that correct?

To which @danderson said:

I'm not sure if a v6+zone prefix makes sense. My mind immediately jumped to v6 link-local prefixes, which would implicitly be per-interface things, but I don't know if they conventionally use the addr zone to represent that scoping.

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