cliserver

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package cliserver resolves factory API server base URIs and builds request URLs.

Index

Constants

View Source
const (
	// DefaultBaseURI is the factory API base when no --server value is provided.
	DefaultBaseURI = "http://localhost:7437"
)

Variables

This section is empty.

Functions

func RequestURL

func RequestURL(server, path string) (string, error)

RequestURL resolves server into a base URI and joins path into a full request URL.

Types

type Base

type Base struct {
	URL url.URL
}

Base is a validated http or https factory API server base URI.

func ResolveBase

func ResolveBase(raw string) (Base, error)

ResolveBase parses raw into a validated server base URI. An empty or whitespace-only raw value defaults to DefaultBaseURI.

func (Base) JoinPath

func (b Base) JoinPath(path string) (url.URL, error)

JoinPath joins an API path onto the base without producing double slashes. path may be absolute (leading slash) or relative; an empty path returns the base URL.

func (Base) String

func (b Base) String() string

String returns the base URI without a trailing slash on the path component.

type LocalBindTarget

type LocalBindTarget struct {
	Host string
	Port int
}

LocalBindTarget is the host and TCP port derived from a local --server URI for you run.

func LocalBindTargetFromBase

func LocalBindTargetFromBase(base Base) (LocalBindTarget, error)

LocalBindTargetFromBase derives a local bind host and TCP port from a validated base URI.

func LocalBindTargetFromServer

func LocalBindTargetFromServer(server string) (LocalBindTarget, error)

LocalBindTargetFromServer resolves server into a validated local bind host and TCP port. The server host must be a local loopback name (localhost, 127.0.0.1, or ::1).

Jump to

Keyboard shortcuts

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