endpoint

package
v0.4.0-rc.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package endpoint is how a fiber's address is written, chosen and dialled. Clone returns one string; it is a URL with a scheme:

unix:///var/lib/fiberd/run/<grant>/<epoch>-<seq>.sock   same-host callers
tcp://10.0.0.7:30012  tcp://[fd00::7]:30012      callers over the network

Which family a home hands out is declared per deployment (a flag on the standalone home, the Pod's addresses under Kubernetes), never discovered by callers: they dial what they were given. Under a shared address, fibers are told apart by port, which is the model for IPv4 and equally for one IPv6 address per grant. Per-fiber IPv6 addresses would be a further policy (a delegated prefix per grant, a network namespace per fiber) and are not built.

The core never parses endpoints; this package serves the host runtime that mints them, the conformance suite that checks their form, and the tools that dial them.

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupported = errors.New("endpoint: unsupported scheme")

ErrUnsupported: the endpoint's scheme is not one this dialer speaks.

Functions

func Dial

func Dial(ctx context.Context, s string) (net.Conn, error)

Dial connects to a fiber endpoint of either scheme.

func UnixPath

func UnixPath(s string) string

UnixPath is the socket path of a unix endpoint, "" for any other.

func Validate

func Validate(s string) error

Validate is what the conformance suite asks of every endpoint a home returns: it parses, its scheme is one of the two, and a tcp host is a well-formed host:port (an IPv6 literal bracketed).

Types

type Endpoint

type Endpoint struct {
	Scheme string // "unix" or "tcp"
	Path   string // unix
	Host   string // tcp: an IP literal or name, never bracketed
	Port   int    // tcp
}

Endpoint is one parsed fiber address.

func Parse

func Parse(s string) (Endpoint, error)

Parse reads an endpoint URL. A bare absolute path is accepted as a unix endpoint, for the tools.

func (Endpoint) Network

func (e Endpoint) Network() (network, address string)

Network is what net.Dial takes.

func (Endpoint) String

func (e Endpoint) String() string

String formats the endpoint as the URL Clone returns; IPv6 hosts are bracketed.

type Family

type Family string

Family is the address family a home hands out.

const (
	Unix  Family = "unix"  // unix sockets under the run directory
	Inet4 Family = "inet4" // tcp on one IPv4 address, a port per fiber
	Inet6 Family = "inet6" // tcp on one IPv6 address, a port per fiber
)

func ParseFamily

func ParseFamily(s string) (Family, error)

ParseFamily reads a -endpoint-family value.

func (Family) Scheme

func (f Family) Scheme() string

Scheme is the URL scheme a family's endpoints carry.

type Policy

type Policy struct {
	Family Family
	// Host is the address advertised for Inet4 and Inet6: the one
	// address the grant's fibers share (a node address, a Pod IP).
	Host string
	// PortMin and PortMax bound the ports handed out, one per live
	// fiber; 0 means 30000-32767.
	PortMin, PortMax int
}

Policy is what a home declares about the endpoints it mints.

func (Policy) Ports

func (p Policy) Ports() (lo, hi int)

Ports is the effective port range.

func (Policy) Validate

func (p Policy) Validate() error

Validate checks a policy before a runtime is opened with it.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL