pyroughtime - A Python 3 Roughtime implementation
Project description
pyroughtime
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
REF: https://packaging.python.org/en/latest/tutorials/packaging-projects/
$ python3.11 -m pip install --upgrade build cffi twine
$ python3.11 -m build
# Test
$ python3.11 -m twine upload --repository testpypi dist/*
# Release
$ python3.11 -m twine upload dist/*
License
This project is licensed under the GNU General Public License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyroughtime-1.0.1.tar.gz
.
File metadata
- Download URL: pyroughtime-1.0.1.tar.gz
- Upload date:
- Size: 49.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 915e9100a362d1b1876f71796dcd4cb4e4bbf1f5cab913292831c615bbe595b7 |
|
MD5 | effee2c078e52e7a8c435dde0729651d |
|
BLAKE2b-256 | eb12ab253b55fe66e81ead0bd185a9d4b179f6b292b9101fb07fa5162e0f940a |
File details
Details for the file pyroughtime-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: pyroughtime-1.0.1-py3-none-any.whl
- Upload date:
- Size: 37.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3026dcea6d98b94f654313194b8e636e3b1384f6670bc8252e85534df856fae |
|
MD5 | b5b352c2251f534a4d79c32a38b28b05 |
|
BLAKE2b-256 | f8468343d04eb169d84775a9678025b7eadee8ea2c13bd8241e46e44006fc3c0 |