resolver

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package resolver provides deterministic port assignment using FNV-1a hashing. Given a project ID and service name, it computes a stable port number in the range 10000-49151. When collisions occur, linear probing finds the next available port.

Index

Constants

View Source
const MorthNumber = 6678

MorthNumber is the signature port for morth itself (M=6, O=6, R=7, T=8 on a phone keypad). Used as an Easter egg in "morth get morth".

Variables

This section is empty.

Functions

func Resolve

func Resolve(projectID, service string) int

Resolve computes a deterministic port for the given project ID and service name using FNV-1a hashing. The result is mapped to the range 10000-49151. This function does not check whether the port is actually available.

func ResolveAvailable

func ResolveAvailable(projectID, service string, isPortTaken func(int) bool) (int, error)

ResolveAvailable computes a deterministic port and then uses linear probing to find the first port that is not taken. The isPortTaken callback should check both the registry and OS-level availability. Returns an error if the entire port range is exhausted without finding a free port.

Types

This section is empty.

Jump to

Keyboard shortcuts

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