{"id":23409301,"url":"https://github.com/briansipos/dtn-demo-agent","last_synced_at":"2026-02-04T02:02:20.391Z","repository":{"id":122373909,"uuid":"324904112","full_name":"BrianSipos/dtn-demo-agent","owner":"BrianSipos","description":"Python implementation of basic BPv7-related protocols","archived":false,"fork":false,"pushed_at":"2026-01-30T02:22:00.000Z","size":898,"stargazers_count":4,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-30T16:35:34.109Z","etag":null,"topics":["bpsec","cose","dtn","dtn-bpbis","tcp-ip"],"latest_commit_sha":null,"homepage":"https://briansipos.github.io/dtn-demo-agent/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BrianSipos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-12-28T03:38:24.000Z","updated_at":"2026-01-30T01:52:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"a591effc-a95b-4dc5-9bfb-f8c6033b3bbc","html_url":"https://github.com/BrianSipos/dtn-demo-agent","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/BrianSipos/dtn-demo-agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrianSipos%2Fdtn-demo-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrianSipos%2Fdtn-demo-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrianSipos%2Fdtn-demo-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrianSipos%2Fdtn-demo-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BrianSipos","download_url":"https://codeload.github.com/BrianSipos/dtn-demo-agent/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BrianSipos%2Fdtn-demo-agent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29064201,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-04T01:55:38.219Z","status":"online","status_checked_at":"2026-02-04T02:00:07.999Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bpsec","cose","dtn","dtn-bpbis","tcp-ip"],"created_at":"2024-12-22T15:35:03.580Z","updated_at":"2026-02-04T02:02:20.380Z","avatar_url":"https://github.com/BrianSipos.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python implementation of basic BPv7-related protocols\n\nThe demo TCPCL agent implements the corresponding specification draft.\nA TCPCL agent is symmetric, there is no notion of a single agent being a \"server\" or a \"client\".\nThe demo agent hosted here has an optional startup action, which is to either listen on an address+port (act as a passive node in a TCPCL session) or to connect to an address+port (act as an active node in a TCPCL session).\nOnce the agent is started, regardless of which or if a startup action was given, the agent can be commanded via D-Bus to listen/connect for later sessions or to transport bundles over existing sessions.\n\n## Starting the Agent\n\nAll of these commands require either a local installation of the python packages, or using an environment such as\n```\nPYTHONPATH=demo-agent/src\n```\n\nWhen running local--local testing on loopback device \"lo\" alternate address assignments must be made similarly to:\n```\nsudo ip -4 addr add 127.0.0.2/8 dev lo\nsudo ip -4 addr add 127.0.0.3/8 dev lo\nsudo ip -6 addr add ::2/128 dev lo\nip link set dev lo multicast on\n```\n\nA pair of TCPCL entities can be created with commands:\n```\npython3 -m tcpcl.agent --config-file=server.yaml\npython3 -m tcpcl.agent --config-file=client.yaml\n```\n\nIt is also possible for either the active- or passive-side agent to log TLS ephemeral key data using the `SSLKEYLOGFILE` environment variable to specify a key material log file (in an indentical way to how Firefox/Chrome browsers use it).\n\n## Commanding the Agent\nThe agent can be accessed via D-Bus based on the `bus-service` name given on the command line.\n\n### Agent Interface\n\nThe agent itself is accessible via the object `/org/ietf/dtn/tcpcl/Agent` with interface `org.ietf.dtn.tcpcl.Agent`.\n\nThe methods in this interface are:\n\n- `listen(address, port)` to cause the agent to listen on a given port.\n- `listen_stop(address, port)` to cause the agent to stop listening.\n- `connect(address, port)` to cause the agent to attempt a connection to a peer.\n- `shutdown()` causes any open sessions to be terminated, which itself may wait on in-progress transfers to complete. The return value is `True` if the agent stopped immediately, or `False` if sessions are being waited on before stopping.\n- `stop()` forces the process to exit immediately and not wait.\n\nThe signals in this interface are:\n\n- `connection_opened(path)` is emitted when a new TCP connection is opened and session negotiation begins. This does not mean the session is established and ready for use, just that a session may be established on the new connection.\n- `connection_closed(path)` is emitted when a TCP connection is closed.\n\n### Session Interface\n\nEach established session is accessible via the object `/org/ietf/dtn/tcpcl/Contact{N}`, where `{N}` is some unique identifier number, with interface `org.ietf.dtn.tcpcl.Contact`.\n\nNotable methods in this interface are:\n\n- `is_sess_idle()` which returns true when the session is established, ready for use, and no messages are being sent or recevied.\n- `is_secure()` which returns true if TLS is used to secure the session.\n- `send_bundle_get_queue()` which returns Transfer IDs which are queued for sending.\n- `send_bundle_file(filepath)` which queues transfer of a file directly from the filesystem. The agent must have sufficient permission to read from the file. The return value is the new Transfer ID.\n- `send_bundle_data(bytes)` which queues transfer of data from the message itself. The return value is the new Transfer ID.\n- `recv_bundle_get_queue()` which returns the Transfer IDs which have been received and are ready.\n- `recv_bundle_pop_file(bid, filepath)` which takes a received transfer directly into the filesystem. The `bid` argument is the Transfer ID to pop. The agent must have sufficient permission to write to the file.\n- `recv_bundle_pop_data(bid)` which takes a received transfer and returns its contents as a byte array. The `bid` argument is the Transfer ID to pop. The return value is the transfer data itself.\n- `terminate(reason_code)` which performs the session termination procedure, which waits for any in-progress transfers to complete then closes the TCP connection.\n- `close()` which closes the TCP connection immediately.\n\nFiles can be sent with commands similar to:\n```\ndbus-send --print-reply --dest=tcpcl.Client /org/ietf/dtn/tcpcl/Contact0 org.ietf.dtn.tcpcl.Contact.send_bundle_file string:\"/etc/hostname\"\n```\n\nFiles can be popped out of the agent after reception with commands similar to:\n```\ndbus-send --print-reply --dest=tcpcl.Server /org/ietf/dtn/tcpcl/Contact0 org.ietf.dtn.tcpcl.Contact.recv_bundle_get_queue\n```\nto get the received Transfer ID, and\n```\ndbus-send --print-reply --dest=tcpcl.Server /org/ietf/dtn/tcpcl/Contact0 org.ietf.dtn.tcpcl.Contact.recv_bundle_pop_file string:1 string:/tmp/dest\n```\nto actually save the received bundle.\n\n## Network Sequencing Tests\n\nThere is a full end-to-end agent test which can be run by the command:\n```\npython3 -m tcpcl.test.bundlegen \u003cgentype\u003e \u003cgencount\u003e\n```\nwhere `gentype` of \"fullvalid\" generates valid BPv7 test bundles, and `gencount` is the total number of bundles to generate and transfer.\n\n# Containerized nodes\n\nThe `run.py` commands use the environment `DOCKER` to control the container tool.\nFor example in fedora use the environment `DOCKER=\"sudo podman\"`.\n\nTo install prerequisites for python run:\n```\npip3 install '.[container]'\n```\n\nTo initialize and start a set of containers:\n```\n./container/run.py --config container/example.yaml act pkigen build create start ready\n```\n\nTo observe the log of one of the nodes:\n```\n./container/run.py --config container/example.yaml exec node000 -- journalctl -f\n```\n\nTo capture traffic across container networks, run similar to:\n```\nwireshark -i br-dtnA -i br-dtnB -f 'port 4556 or port 1113 or icmp' -Y 'bpv7' -k\n```\n\nTo call DBus methods in one of the nodes:\n```\n./container/run.py --config container/example.yaml exec node000 dbus-send --system --print-reply --dest=org.ietf.dtn.node.udpcl /org/ietf/dtn/udpcl/Agent org.ietf.dtn.udpcl.Agent.pmtud_start string:node002. uint16:4556\n```\n\n## ACME Validation Prototype\n\nTo perform an ACME validation exchange between two nodes run the script:\n\n```\n node000 dbus-send --system --print-reply --dest=org.ietf.dtn.node.bp /org/ietf/dtn/bp/app/admin org.ietf.dtn.bp.admin.start_expect_acme_request string:\"dDtaviYTPUWFS3NK37YWfQ\" string:\"tPUZNY4ONIk6LxErRFEjVw\" string:\"LPJNul-wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ\" \u0026\u0026 \\\ndocker container exec -it node001 dbus-send --system --print-reply --dest=org.ietf.dtn.node.bp /org/ietf/dtn/bp/app/admin org.ietf.dtn.bp.admin.send_acme_request string:\"dtn://node000/\" string:\"dDtaviYTPUWFS3NK37YWfQ\" string:\"tPUZNY4ONIk6LxErRFEjVw\" string:\"p3yRYFU4KxwQaHQjJ2RdiQ\" string:\"LPJNul-wow4m6DsqxbninhsWHlwfp0JecwQzYpOLmCQ\" \u0026\u0026 \\\ndocker container exec -it node000 dbus-send --system --print-reply --dest=org.ietf.dtn.node.bp /org/ietf/dtn/bp/app/admin org.ietf.dtn.bp.admin.stop_expect_acme_request string:\"dDtaviYTPUWFS3NK37YWfQ\"\n```\n\n## SAFE Prototype\n\nTo initiate a primary SA with another SAFE endpoint run:\n\n```\n./container/run.py --config container/example-safe.yaml exec node000 -- dbus-send --system --print-reply --dest=org.ietf.dtn.node.bp /org/ietf/dtn/bp/app/safe org.ietf.dtn.bp.safe.start string:dtn://node001/safe\n```\n\n## UDPCLv2 Prototype\n\nA demonstration of active queue management (AQM) with a variation of the Prague congestion control algorithm (CCA) can be run with the following, which will configure container interfaces to use HTB rate control down to 100kBps with a CoDEL queue for ECN marking and then transfer an 8MB ADU which takes more than a minute at that rate.\n\n```sh\n./container/run.py --config container/example-sand.yaml act pkigen build create start ready rate_ctrl \u0026\u0026 \\\nsleep 9 \u0026\u0026 \\\ndocker container exec node001 dbus-send --system --print-reply --dest=org.ietf.dtn.node.bp /org/ietf/dtn/bp/Agent org.ietf.dtn.bp.Agent.ping string:\"dtn://node002/sand\" int32:8000000\n```\n\n# Wireshark Protocols and Dissectors\n\nThe wireshark modules have been moved into separate project [dtn-wireshark](https://github.com/BSipos-RKF/dtn-wireshark).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriansipos%2Fdtn-demo-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbriansipos%2Fdtn-demo-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbriansipos%2Fdtn-demo-agent/lists"}