{"id":28546200,"url":"https://github.com/bbfh-dev/protox","last_synced_at":"2025-07-01T01:35:22.322Z","repository":{"id":297212793,"uuid":"994873297","full_name":"bbfh-dev/protox","owner":"bbfh-dev","description":"Go library for (de-)serializing custom protocols","archived":false,"fork":false,"pushed_at":"2025-06-04T16:47:27.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-04T18:08:05.185Z","etag":null,"topics":["binary","data","format","go","library","parsing","protocol","reader","writer"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bbfh-dev.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}},"created_at":"2025-06-02T16:00:05.000Z","updated_at":"2025-06-04T16:47:17.000Z","dependencies_parsed_at":"2025-06-04T18:11:09.187Z","dependency_job_id":"9cb1733b-5488-437a-85c8-300a39ac3337","html_url":"https://github.com/bbfh-dev/protox","commit_stats":null,"previous_names":["bbfh-dev/protox"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/bbfh-dev/protox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbfh-dev%2Fprotox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbfh-dev%2Fprotox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbfh-dev%2Fprotox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbfh-dev%2Fprotox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbfh-dev","download_url":"https://codeload.github.com/bbfh-dev/protox/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbfh-dev%2Fprotox/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262879639,"owners_count":23378650,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["binary","data","format","go","library","parsing","protocol","reader","writer"],"created_at":"2025-06-09T23:09:05.361Z","updated_at":"2025-07-01T01:35:22.312Z","avatar_url":"https://github.com/bbfh-dev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Protox\n\nGo library for (de-)serializing custom protocols\n\n# Usage\n\nUse `protox.New().\u003c...\u003e.Build()` to define a processor that uses a specific format for writing/reading. You can call `Read` or `Write` methods on the resulting `*protox.Processor` to (de-)serialize data.\n\nHere's an example using a struct, it uses all allowed variable formats:\n\n```go\nimport \"github.com/bbfh-dev/protox\"\n\ntype Example struct {\n    Byte        byte\n    BytesDelim  []byte\n    String      string\n    StringDelim string\n    Int         int64\n    IntDelim    int64\n    FloatDelim  float64\n    StringMap   map[string]string\n    StringArr   []string\n}\n\nfunc (example *Example) Protox() *protox.Processor {\n    return protox.New().\n        ThenByte(\u0026example.Byte).\n        ThenBytesDelim(\u0026example.BytesDelim, '\\x00').\n        ThenString(\u0026example.String, 3).\n        ThenStringDelim(\u0026example.StringDelim, '\\x00').\n        ThenInt(\u0026example.Int).\n        ThenIntDelim(\u0026example.IntDelim, '\\x00').\n        ThenFloatDelim(\u0026example.FloatDelim, '\\x00').\n        ThenStringMap(example.StringMap, '=', '\\x00', '\\x00').\n        ThenStringArray(\u0026example.StringArr, ',', ';').\n        Build()\n}\n\nfunc write(buffer *bytes.Buffer) {\n    err := example.Protox().Write(buffer)\n    fmt.Println(buffer.String()) // \"gabc\\x00hi!Hello World!\\x009\\x05\\x00\\x00\\x00\\x00\\x00\\x0042069\\x00420.69\\x00a=(1)\\x00b=(2)\\x00c=(3)\\x00\\x00\"\n}\n\nfunc read(buffer *bytes.Buffer) {\n    instance := \u0026Example{}\n    err := instance.Protox().Read(bufio.NewReader(buffer))\n    fmt.Prinln(instance) // \u0026protox_test.Example{Byte:0x67, BytesDelim:[]uint8{0x61, 0x62, 0x63}, String:\"hi!\", StringDelim:\"Hello World!\", Int:1337, IntDelim:42069, FloatDelim:420.69, StringMap:map[string]string{\"a\":\"(1)\", \"b\":\"(2)\", \"c\":\"(3)\"}}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbfh-dev%2Fprotox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbfh-dev%2Fprotox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbfh-dev%2Fprotox/lists"}