A small NXTP client and server.
To run the server, simply do:
$ nxtpBy default, the server runs on localhost:12300, but you can get it to listen
on a different interface with the -endpoint flag:
$ nxtp -endpoint :12300To use it as a client, pass the -client flag. The -endpoint flag can be
used with this to specify the server to connect to:
$ nxtp -client -endpoint time.nxtel.org:12300By default, the client assumes the timezone to use is UTC. However, you can
supply a Windows timezone specifier with the -tz flag:
$ nxtp -client -endpoint time.nxtel.org:12300 -tz "Nepal Standard Time"In server mode, nxtp supports IANA timezone specifiers, but other servers are
not guaranteed to support anything other than Windows timezone specifiers.
nxtp doesn't daemonise due to complications from the Go runtime, so it's up
to your process supervisor to manage it. With systemd, you can use the
following unit:
[Unit]
Description=Network neXt Time Protocol (NXTP) server
Wants=network.target
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/nxtp
KillMode=process
RestartSec=5s
Restart=on-failure
[Install]
WantedBy=multi-user.targetUnder contrib is a NetBSD rc script. It expects daemond to be installed
to help daemonise the server, which you can do with pkgin install daemond.
To start the daemon in a Docker container, run:
docker run -d -p 12300:12300 ghcr.io/kgaughan/nxtp:latestIt's best if you download a release or use a container image, but if you really want to build your own, run:
$ make nxtpIf building for a Raspberry PI, you'll need to also define GOARCH=arm in your
environment, GOOS too, with a value of the target OS such as linux,
netbsd, &c.
Translations of Windows timezone specifications to IANA ones are souced from
the Unicode Common Locale Data Repository,
specifically common/supplemental/windowsZones.xml in that repository.