{"id":25668467,"url":"https://github.com/borud/hdlc","last_synced_at":"2026-04-17T06:03:12.967Z","repository":{"id":57661787,"uuid":"476817007","full_name":"borud/hdlc","owner":"borud","description":"HDLC'ish unframer","archived":false,"fork":false,"pushed_at":"2022-05-30T18:54:29.000Z","size":14,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-24T10:43:35.516Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/borud.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}},"created_at":"2022-04-01T17:46:13.000Z","updated_at":"2022-04-14T13:27:40.000Z","dependencies_parsed_at":"2022-09-13T00:32:08.391Z","dependency_job_id":null,"html_url":"https://github.com/borud/hdlc","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/borud/hdlc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borud%2Fhdlc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borud%2Fhdlc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borud%2Fhdlc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borud%2Fhdlc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/borud","download_url":"https://codeload.github.com/borud/hdlc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/borud%2Fhdlc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31917372,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","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":[],"created_at":"2025-02-24T10:34:06.005Z","updated_at":"2026-04-17T06:03:12.949Z","avatar_url":"https://github.com/borud.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HDLC\n\n[![Godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/borud/hdlc)\n\nHDLC is a library for unframing HDLC-like frames. Instead of implementing this as an io.Reader,\nwe read whole frames from a channel.  This avoids misunderstandings that might arise if you use the io.Reader interface.\n\nAssuming you have an `io.Reader` named `myReader` this is how you unframe things.\n\n```go\nimport \"github.com/borud/hdlc\"\n...\n\n unframer := NewUnframer(myReader)\n\n...\n\n for range unframer.Frames() {\n     // do something with the frames\n }\n```\n\n## Framing format\n\nThe framing format defines three special values:\n\n```go\nconst (\n    FlagEscape = byte(0x7d)\n    FlagSep    = byte(0x7e)\n    FlagAbort  = byte(0x7f)\n    XORMask    = byte(0x20)\n)\n```\n\n- Each frame starts and ends with a `FlagSep` byte\n- If we encounter a `FlagAbort` value it means we abort the current frame and wait for the next frame beginning before accumulating data.\n- If values equal to `FlagEscape`, `FlagSep` or `FlagAbort` occur in the payload it needs to be escaped. Escaping happens by replacing the value with two bytes: FlagEscape followed by the value we are escaping XOR'ed by XORMask (we flip the 5th bit).\n\nUnframing is just applying this process in reverse.\n\n### API choice\n\nRather than implement the unframer as an `io.Reader` we explicitly chose an API that reflects that this is not an `io.Reader`.  We are not reading a stream, we are reading discrete frames. This means that if you were to wrap it in something that assumes a stream, you would run into problems.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborud%2Fhdlc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fborud%2Fhdlc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fborud%2Fhdlc/lists"}