nfd-status-http-server: change default port to 6380
Change-Id: Ibccd79d04da346443ad17db9220940c488bc9873
diff --git a/Dockerfile b/Dockerfile
index 17a0a75..b8fa4e5 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -10,24 +10,24 @@
ARG JOBS
ARG SOURCE_DATE_EPOCH
RUN --mount=rw,target=/src <<EOF
-set -eux
-cd /src
-./waf configure \
- --prefix=/usr \
- --libdir=/usr/lib \
- --sysconfdir=/etc \
- --localstatedir=/var \
- --sharedstatedir=/var \
- --without-systemd
-./waf build
-./waf install
-mkdir -p /deps/debian
-touch /deps/debian/control
-cd /deps
-for binary in nfd nfdc nfd-autoreg; do
- dpkg-shlibdeps --ignore-missing-info "/usr/bin/${binary}" -O \
- | sed -n 's|^shlibs:Depends=||p' | sed 's| ([^)]*),\?||g' > "${binary}"
-done
+ set -eux
+ cd /src
+ ./waf configure \
+ --prefix=/usr \
+ --libdir=/usr/lib \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --sharedstatedir=/var \
+ --without-systemd
+ ./waf build
+ ./waf install
+ mkdir -p /deps/debian
+ touch /deps/debian/control
+ cd /deps
+ for binary in nfd nfdc; do
+ dpkg-shlibdeps --ignore-missing-info "/usr/bin/${binary}" -O \
+ | sed -n 's|^shlibs:Depends=||p' | sed 's| ([^)]*),\?||g' > "${binary}"
+ done
EOF
@@ -35,10 +35,6 @@
COPY --link --from=build /usr/bin/nfd-autoreg /usr/bin/
-RUN --mount=from=build,source=/deps,target=/deps \
- apt-get install -Uy --no-install-recommends $(cat /deps/nfd-autoreg) \
- && apt-get distclean
-
ENV HOME=/config
VOLUME /config
VOLUME /run/nfd
@@ -53,7 +49,8 @@
COPY --link --from=build /usr/share/ndn/ /usr/share/ndn/
RUN --mount=from=build,source=/deps,target=/deps \
- apt-get install -Uy --no-install-recommends $(cat /deps/nfdc) \
+ apt-get install -Uy --no-install-recommends \
+ $(cat /deps/nfdc) \
python3 \
&& apt-get distclean
@@ -61,7 +58,7 @@
VOLUME /config
VOLUME /run/nfd
-EXPOSE 8080/tcp
+EXPOSE 6380/tcp
ENTRYPOINT ["/usr/bin/nfd-status-http-server", "--address", "0.0.0.0"]
@@ -73,7 +70,8 @@
COPY --link --from=build /etc/ndn/nfd.conf.sample /config/nfd.conf
RUN --mount=from=build,source=/deps,target=/deps \
- apt-get install -Uy --no-install-recommends $(cat /deps/nfd /deps/nfdc) \
+ apt-get install -Uy --no-install-recommends \
+ $(cat /deps/nfd /deps/nfdc) \
&& apt-get distclean
ENV HOME=/config
diff --git a/docs/manpages/nfd-status-http-server.rst b/docs/manpages/nfd-status-http-server.rst
index 9d6ee15..5dc4b0c 100644
--- a/docs/manpages/nfd-status-http-server.rst
+++ b/docs/manpages/nfd-status-http-server.rst
@@ -9,7 +9,7 @@
Description
-----------
-``nfd-status-http-server`` is a daemon that enables retrieval of NFD status via HTTP protocol.
+``nfd-status-http-server`` is a daemon that enables the retrieval of NFD's status over HTTP.
Options
-------
@@ -21,7 +21,7 @@
HTTP server IP address (default is 127.0.0.1).
``-p <PORT>``
- HTTP server port number (default is 8080).
+ HTTP server port number (default is 6380).
``-r``
Enable HTTP robots to crawl (disabled by default).
@@ -32,10 +32,10 @@
Examples
--------
-Enable NFD HTTP status server on all IPv4 interfaces::
+Start NFD's HTTP status server on all IPv4 interfaces, port 80 (requires root)::
- nfd-status-http-server -p 80 -a 0.0.0.0
+ nfd-status-http-server -a 0.0.0.0 -p 80
-Enable NFD HTTP status server on all IPv6 interfaces::
+Start NFD's HTTP status server on all IPv6 interfaces, port 8000::
- nfd-status-http-server -p 80 -a ::
+ nfd-status-http-server -a :: -p 8000
diff --git a/tools/nfd-status-http-server.py b/tools/nfd-status-http-server.py
index ee426cd..40ce9bb 100755
--- a/tools/nfd-status-http-server.py
+++ b/tools/nfd-status-http-server.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
-Copyright (c) 2014-2023, Regents of the University of California,
+Copyright (c) 2014-2024, Regents of the University of California,
Arizona Board of Regents,
Colorado State University,
University Pierre & Marie Curie, Sorbonne University,
@@ -23,9 +23,13 @@
NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
"""
+import argparse
+import ipaddress
+import os
+import socket
+import subprocess
from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
from urllib.parse import urlsplit
-import argparse, ipaddress, os, socket, subprocess
class NfdStatusHandler(SimpleHTTPRequestHandler):
@@ -57,11 +61,7 @@
# add stylesheet processing instruction after the XML document type declaration
# (yes, this is a ugly hack)
if (pos := output.find(">") + 1) != 0:
- xml = (
- output[:pos]
- + '<?xml-stylesheet type="text/xsl" href="nfd-status.xsl"?>'
- + output[pos:]
- )
+ xml = output[:pos] + '<?xml-stylesheet type="text/xsl" href="nfd-status.xsl"?>' + output[pos:]
self.send_response(200)
self.send_header("Content-Type", "text/xml; charset=UTF-8")
self.end_headers()
@@ -110,14 +110,12 @@
parser.add_argument("-V", "--version", action="version", version="@VERSION@")
parser.add_argument("-a", "--address", default="127.0.0.1", type=ip_address, metavar="ADDR",
help="bind to this IP address (default: %(default)s)")
- parser.add_argument("-p", "--port", default=8080, type=port_number,
+ parser.add_argument("-p", "--port", default=6380, type=port_number,
help="bind to this port number (default: %(default)s)")
parser.add_argument("-f", "--workdir", default="@DATAROOTDIR@/ndn", metavar="DIR",
help="server's working directory (default: %(default)s)")
- parser.add_argument("-r", "--robots", action="store_true",
- help="allow crawlers and other HTTP bots")
- parser.add_argument("-v", "--verbose", action="store_true",
- help="turn on verbose logging")
+ parser.add_argument("-r", "--robots", action="store_true", help="allow crawlers and other HTTP bots")
+ parser.add_argument("-v", "--verbose", action="store_true", help="turn on verbose logging")
args = parser.parse_args()
os.chdir(args.workdir)