{"id":14371074,"url":"https://github.com/golioth/xk6-coap","last_synced_at":"2026-01-14T18:51:00.903Z","repository":{"id":185331031,"uuid":"636459693","full_name":"golioth/xk6-coap","owner":"golioth","description":"A k6 extension for CoAP.","archived":false,"fork":false,"pushed_at":"2024-06-10T09:46:42.000Z","size":52,"stargazers_count":16,"open_issues_count":6,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-22T14:47:30.639Z","etag":null,"topics":["coap","k6","k6-extension","xk6"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/golioth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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}},"created_at":"2023-05-04T22:37:35.000Z","updated_at":"2025-04-09T10:25:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"335e9960-884d-4cc1-9467-a5ebcbf3d4f2","html_url":"https://github.com/golioth/xk6-coap","commit_stats":null,"previous_names":["golioth/xk6-coap"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/golioth/xk6-coap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golioth%2Fxk6-coap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golioth%2Fxk6-coap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golioth%2Fxk6-coap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golioth%2Fxk6-coap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/golioth","download_url":"https://codeload.github.com/golioth/xk6-coap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/golioth%2Fxk6-coap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28430933,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T16:38:47.836Z","status":"ssl_error","status_checked_at":"2026-01-14T16:34:59.695Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["coap","k6","k6-extension","xk6"],"created_at":"2024-08-27T23:00:53.368Z","updated_at":"2026-01-14T18:51:00.886Z","avatar_url":"https://github.com/golioth.png","language":"Go","funding_links":[],"categories":["Extensions"],"sub_categories":["Community"],"readme":"# xk6-coap\n\n`xk6-coap` is a [`k6` extension](https://k6.io/docs/extensions/) for the\n[Constrained Application Protocol\n(CoAP)](https://www.rfc-editor.org/rfc/rfc7252).\n\n\u003e **MATURITY NOTICE**: `xk6-coap` is under active development and breaking API\n\u003e changes are to be expected. The project has been open sourced early to ensure\n\u003e that external consumers have an opportunity to influence and contribute to its\n\u003e future direction.\n\n## Getting Started\n\nTo get started, either build the `k6` binary or use the\n[`golioth/xk6-coap`](https://hub.docker.com/repository/docker/golioth/xk6-coap)\nimage.\n\n### Using the OCI Image\n\nThe quickest way to get started is by using the `golioth/xk6-coap` image,\nwhich is [built](./images/xk6-coap/Dockerfile) from this repository and\npublished to DockerHub. Tests can be supplied when creating a container from the\nimage via a [bind mount](https://docs.docker.com/storage/bind-mounts/). For\nexample, the following command would run the [simple\nexample](./examples/simple.js) from this repository.\n\n```\ndocker run -it --rm -e COAP_PSK_ID=\u003cYOUR-PSK-ID\u003e -e COAP_PSK=\u003cYOUR-PSK\u003e -v $(pwd)/examples/simple.js:/simple.js golioth/xk6-coap k6 run /simple.js --vus 10 --duration 5s\n```\n\n`xk6-coap` supports authentication via pre-shared keys (PSKs) and client\ncertificates. The former is provided by specifying environment variables, while\nthe latter is provided by specifying file paths. The `simple.js` example passes\n`COAP_PSK_ID` and `COAP_PSK` to the instantiated `Client`, which will cause it\nuse use the respective values for PSK authentication. If a `Client` is\ninstantiated with both PSK environment variables and certificate file paths,\ncertificate authentication will take precedence.\n\n```js\nclient = new Client(\n\t\"coap.golioth.io:5684\",\n\t\"COAP_PSK_ID\",\n\t\"COAP_PSK\",\n);\n```\n\u003e Only PSK is provided and it will be used for authentication.\n\n```js\nclient = new Client(\n\t\"coap.golioth.io:5684\",\n\t\"\",\n\t\"\",\n\t\"path/to/client/crt.pem\",\n\t\"path/to/client/key.pem\",\n);\n```\n\u003e Only certificate is provided and it will be used for authentication.\n\n```js\nclient = new Client(\n\t\"coap.golioth.io:5684\",\n\t\"COAP_PSK_ID\",\n\t\"COAP_PSK\",\n\t\"path/to/client/crt.pem\",\n\t\"path/to/client/key.pem\",\n);\n```\n\u003e Both are provided but certificate takes precedence.\n\n\n### Building a k6 Binary\n\nUsing `k6` extentions requires including the extension(s) in a `k6` build. The\n[`xk6`](https://github.com/grafana/xk6) tool will handle executing the build,\nand the `Makefile` in this repository will ensure that `xk6` is installed and\nproduces a valid build.\n\n```\nmake build\n```\n\nThis will produce a `k6` binary in the current working directory. To execute a\ntest with 2 virtual users making connections and sending `GET` messages for 5\nseconds, the following command could be run.\n\n```\n./k6 run ./examples/simple.js --vus 10 --duration 5s\n```\n\nReference the [`k6` documentation](https://k6.io/docs/using-k6/test-lifecycle/)\nfor more information on how to configure and run tests.\n\n## Attribution\n\n`xk6-coap` is essentially glue machinery that allows for\n[`plgd-dev/go-coap`](https://github.com/plgd-dev/go-coap) /\n[`pion/dtls`](https://github.com/plgd-dev/go-coap) functionality to be exposed\nto `k6` tests. This project would not be possible without the work done by\ncontributors (some of whom are on the Golioth team!) on both of those projects.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgolioth%2Fxk6-coap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgolioth%2Fxk6-coap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgolioth%2Fxk6-coap/lists"}