Module: Portless::Constants

Defined in:
lib/portless/constants.rb

Constant Summary collapse

DEFAULT_STATE_DIR =

Default location for all coordination state (routes, CA, pid/port markers). Mirrors portless's ~/.portless; State.dir reads PORTLESS_STATE_DIR at call time to allow per-run overrides (tests, the sudo'd daemon).

"~/.rb-portless"
HTTPS_PORT =

Default proxy ports: 443 for HTTPS (the default), 80 for --no-tls. When the privileged port can't be bound (sudo denied), we fall back to 1355.

443
HTTP_PORT =
80
FALLBACK_PROXY_PORT =
1355
PRIVILEGED_PORT_THRESHOLD =
1024
MIN_APP_PORT =

Backend app port range. Random-first assignment keeps the collision window small; the WHATWG "bad ports" in range are skipped so browsers never reject.

4000
MAX_APP_PORT =
4999
BLOCKED_PORTS =

WHATWG bad-port set within 4000-4999

[ 4045, 4190, 4096 ].freeze
DEFAULT_TLD =

Default TLD. A project can override (e.g. "shirabe.org.localhost") so its subdomains wildcard-route to one app.

"localhost"
HEALTH_HEADER =

The marker every proxied response carries, so we can tell our proxy from any other process holding the port (used by the health probe).

"x-rb-portless"
HOSTS_BEGIN =

/etc/hosts managed-block fences (Safari / non-.localhost TLDs).

"# rb-portless-start"
HOSTS_END =
"# rb-portless-end"
MAX_PROXY_HOPS =

Reject a dev-server loop that proxies back to us without changing origin.

5
WINDOWS =
(RbConfig::CONFIG["host_os"] =~ /mswin|mingw|cygwin/i) ? true : false
MACOS =
(RbConfig::CONFIG["host_os"] =~ /darwin/i) ? true : false