{"id":18524000,"url":"https://github.com/sunshineplan/limiter","last_synced_at":"2025-04-09T11:31:53.548Z","repository":{"id":172347008,"uuid":"649015575","full_name":"sunshineplan/limiter","owner":"sunshineplan","description":"Limiter for Golang io.Reader and io.Writer","archived":false,"fork":false,"pushed_at":"2025-03-06T07:52:49.000Z","size":28,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T05:22:31.050Z","etag":null,"topics":["go","golang","limiter","traffic-control","transfer"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sunshineplan.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}},"created_at":"2023-06-03T14:05:20.000Z","updated_at":"2025-02-05T07:16:13.000Z","dependencies_parsed_at":"2024-08-05T08:54:36.487Z","dependency_job_id":null,"html_url":"https://github.com/sunshineplan/limiter","commit_stats":null,"previous_names":["sunshineplan/limiter"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunshineplan%2Flimiter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunshineplan%2Flimiter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunshineplan%2Flimiter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sunshineplan%2Flimiter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sunshineplan","download_url":"https://codeload.github.com/sunshineplan/limiter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248031589,"owners_count":21036436,"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":["go","golang","limiter","traffic-control","transfer"],"created_at":"2024-11-06T17:39:00.473Z","updated_at":"2025-04-09T11:31:53.219Z","avatar_url":"https://github.com/sunshineplan.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Limiter\n\n[![GoDev](https://img.shields.io/static/v1?label=godev\u0026message=reference\u0026color=00add8)][godev]\n\n[godev]: https://pkg.go.dev/github.com/sunshineplan/limiter\n\nThe `limiter` package provides reader/writer capabilities with transfer speed limiting in Go.\n\n## Overview\nThe `Limiter` is designed to limit the total transfer speed of readers and writers simultaneously.\n\n## Features\n- Transfer Speed Limiting: Control the speed at which operations can be performed.\n- Dynamic Configuration: Set and update the transfer speed limit and burst size as needed.\n- Contextual Support: Perform operations with transfer speed limits within a specific context.\n\n## Usage\nImport the package in your Go code:\n\n```go\nimport \"github.com/sunshineplan/limiter\"\n```\n\nCreate a new `Limiter` by calling the `New` function:\n\n```go\nlimiter := limiter.New(100*1024)\n```\n\nThe above code creates a `Limiter` with a total transfer speed limit of 100KB per second and a burst size of 100KB.\n\n### Transfer Speed Limiting\n\nTo perform limited operations, you can use the provided `Reader` and `Writer` methods. Here's an example of using the `Reader` method:\n\n```go\nreader := limiter.Reader(yourReader)\n```\n\nThe `Reader` method takes an `io.Reader` and returns a new reader that performs limited reads.\n\nSimilarly, you can use the `Writer` method to create a limited writer:\n\n```go\nwriter := limiter.Writer(yourWriter)\n```\n\n### Updating Configuration\n\nYou can update the limit and burst size of the `Limiter` by calling the respective `Set` methods:\n\n```go\nlimiter.SetLimit(200*1024) // 200KB\nlimiter.SetBurst(20*1024) // 20KB\n```\n\nThese methods allow you to dynamically adjust the limiting behavior according to your requirements.\n\n## Contributing\nContributions are welcome! If you find a bug or have a suggestion for improvement, please open an issue or submit a pull request.\n\n## License\nThis package is released under the [MIT License](https://github.com/sunshineplan/limiter/blob/main/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunshineplan%2Flimiter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsunshineplan%2Flimiter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsunshineplan%2Flimiter/lists"}