#!/usr/bin/env bash
# opensim ports: describe the configured listeners and how to expose them.

USAGE='opensim ports [-hqv] [INSTANCE...] [--publish|--ufw] [--private-address ADDRESS] [--from ADDRESS,...] [--manage-from ADDRESS,...]'
HELP="List instance ports with their protocol, purpose and access category.
  --publish                  print Podman/Docker port mappings
  --ufw                      print public firewall rules; private rules are comments unless --from or --manage-from is given
  --from ADDRESS[,...]       with --ufw: the addresses (IPv4/IPv6, or with /prefix) allowed on the Robust private port
  --manage-from ADDRESS[,...] with --ufw: the addresses allowed on the console ports
  --private-address ADDRESS  bind private and console ports here (default 127.0.0.1)"

source "$(dirname "$(realpath "${BASH_SOURCE[0]}" 2>/dev/null || echo "${BASH_SOURCE[0]}")")/../src/lib/common"

run ports "$@"
