Skip to main content

pyroughtime - A Python 3 Roughtime implementation

Project description

pyroughtime

License: GPL v3

An experimental Roughtime client and server implementation in Python 3 using the IETF draft at https://tools.ietf.org/html/draft-ietf-ntp-roughtime-07.

Dependencies

Installing on Linux

If you run into an error like "This environment is externally managed", you can create a venv and install the dependencies with:

$ sudo add-apt-repository ppa:deadsnakes/ppa
$ sudo apt-get update
$ sudo apt-get install -y python3.11 python3.11-dev python3.11-venv
$ python3.11 -m venv "venv"
$ source venv/bin/activate
$ pip install -r requirements.txt

Currently we have to use Python 3.11 or earlier due to ed25519 not being compatible with Python 3.12.

Example

From Python

from pyroughtime import RoughtimeClient, RoughtimeServer

serv, publ = RoughtimeServer.test_server()
cl = RoughtimeClient()
local_reply = cl.query("127.0.0.1", 2002, publ, newver=True)
google_reply = cl.query("roughtime.sandbox.google.com", 2002, "etPaaIxcBMY1oUeGpwvPMCJMwlRVNxv51KK/tktoJTQ=", newver=False)
serv.stop()
print(local_reply["prettytime"])
print(google_reply["prettytime"])

From CLI

$ ./pyroughtime.py -l ecosystem.json
Caesium:                  2020-12-23 16:26:16.765275 UTC (+/- 1.000  s) (RTT:  100.5 ms)
Chainpoint-Roughtime:     2020-12-23 16:26:16.973777 UTC (+/- 1.000  s) (RTT:  288.9 ms)
Cloudflare-Roughtime:     2020-12-23 16:26:17.267000 UTC (+/- 1.000  s) (RTT:    3.7 ms)
Google-Sandbox-Roughtime: 2020-12-23 16:26:17.307968 UTC (+/- 1.000  s) (RTT:   16.1 ms)
int08h-Roughtime:         2020-12-23 16:26:17.401888 UTC (+/- 1.000  s) (RTT:  177.0 ms)
roughtime.se:             2020-12-23 16:26:17.574568 UTC (+/- 0.000 ms) (RTT:   26.1 ms)
sjwheel:                  2020-12-23 16:26:17.747868 UTC (+/- 1.000  s) (RTT:  485.6 ms)
No inconsistent replies detected.
$ ./pyroughtime.py -s roughtime.se 2002 S3AzfZJ5CjSdkJ21ZJGbxqdYP/SoE8fXKY0+aicsehI=
2020-12-23 16:26:44.499730 UTC (+/- 0.000 ms) (RTT: 25.7 ms)
TAI - UTC = 37s
Leap events:
  2017-01-01
  2015-07-01
  2012-07-01
Delegate key validity start: 2020-12-22 00:00:00.000000
Delegate key validity end:   2022-01-01 00:00:00.000000
Merkle tree path length: 0

Releasing

$ python3.11 -m pip install build twine
$ python3.11 -m build
$ twine upload dist/*

License

This project is licensed under the GNU General Public License - see the LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pyroughtime-1.0.0-py3-none-any.whl (37.3 kB view details)

Uploaded Python 3

File details

Details for the file pyroughtime-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pyroughtime-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 37.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for pyroughtime-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a681693b9ad89accef0d4a9e20608d3a73b9b5b44f63670256adc30785f8def9
MD5 a59cd0c8318b9917d72882e00fbeb673
BLAKE2b-256 08cec5f4dd0568eded142b11170bde72a96ce2bdc6c37948b94c8a87168a63e4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page