kgaughan / nxtp

A Network neXt Time Protocol (NXTP) client and server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nxtp

A small NXTP client and server.

Usage

To run the server, simply do:

$ nxtp

By default, the server runs on localhost:12300, but you can get it to listen on a different interface with the -endpoint flag:

$ nxtp -endpoint :12300

To 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:12300

By 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.

Running as a daemon

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
After = network.target

[Service]
Type = simple
ExecStart = /usr/bin/nxtp
KillMode = process
RestartSec = 5s
Restart = on-failure

Under 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.

Building

Run the following:

$ make

If 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.

Timezone data

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.

About

A Network neXt Time Protocol (NXTP) client and server

License:MIT License


Languages

Language:Go 83.4%Language:Shell 6.5%Language:Python 5.7%Language:Makefile 2.6%Language:Dockerfile 1.8%