{"id":13509827,"url":"https://github.com/cevatbarisyilmaz/lossy","last_synced_at":"2026-02-05T06:11:12.220Z","repository":{"id":57497717,"uuid":"203593490","full_name":"cevatbarisyilmaz/lossy","owner":"cevatbarisyilmaz","description":"Go package to simulate bandwidth, latency and packet loss for net.PacketConn and net.Conn interfaces","archived":false,"fork":false,"pushed_at":"2019-10-05T12:22:12.000Z","size":20,"stargazers_count":321,"open_issues_count":2,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-14T04:50:50.616Z","etag":null,"topics":["go","golang","latency","lossy","packet-loss","udp"],"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/cevatbarisyilmaz.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":"2019-08-21T13:46:06.000Z","updated_at":"2025-08-12T12:28:00.000Z","dependencies_parsed_at":"2022-09-03T23:20:55.169Z","dependency_job_id":null,"html_url":"https://github.com/cevatbarisyilmaz/lossy","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/cevatbarisyilmaz/lossy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cevatbarisyilmaz%2Flossy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cevatbarisyilmaz%2Flossy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cevatbarisyilmaz%2Flossy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cevatbarisyilmaz%2Flossy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cevatbarisyilmaz","download_url":"https://codeload.github.com/cevatbarisyilmaz/lossy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cevatbarisyilmaz%2Flossy/sbom","scorecard":{"id":271651,"data":{"date":"2025-08-11","repo":{"name":"github.com/cevatbarisyilmaz/lossy","commit":"bf9db5a35016bd0e32d572de6ce3e0633dc83ff8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/14 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-17T13:33:22.024Z","repository_id":57497717,"created_at":"2025-08-17T13:33:22.024Z","updated_at":"2025-08-17T13:33:22.024Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29114745,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T05:31:32.482Z","status":"ssl_error","status_checked_at":"2026-02-05T05:31:29.075Z","response_time":65,"last_error":"SSL_read: 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":["go","golang","latency","lossy","packet-loss","udp"],"created_at":"2024-08-01T02:01:13.865Z","updated_at":"2026-02-05T06:11:12.195Z","avatar_url":"https://github.com/cevatbarisyilmaz.png","language":"Go","funding_links":[],"categories":["开源类库","Go","Open source library","golang"],"sub_categories":["网络","The Internet"],"readme":"# lossy\n[![GoDoc](https://godoc.org/github.com/cevatbarisyilmaz/lossy?status.svg)](https://godoc.org/github.com/cevatbarisyilmaz/lossy)\n[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/cevatbarisyilmaz/lossy?sort=semver)](https://github.com/cevatbarisyilmaz/lossy/releases)\n[![GitHub](https://img.shields.io/github/license/cevatbarisyilmaz/lossy)](https://github.com/cevatbarisyilmaz/lossy/blob/master/LICENSE)\n[![Go Report Card](https://goreportcard.com/badge/github.com/cevatbarisyilmaz/lossy)](https://goreportcard.com/report/github.com/cevatbarisyilmaz/lossy)\n\nGo package to simulate bandwidth, latency and packet loss for net.PacketConn and net.Conn interfaces.\n\nIts main usage is to test robustness of applications and network protocols run over unreliable transport protocols such as UDP or IP.\nAs a side benefit, it can also be used as outbound bandwidth limiter.\n\nlossy only alters the writing side of the connection, reading side is kept as it is.\n\n## Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/cevatbarisyilmaz/lossy\"\n\t\"log\"\n\t\"math/rand\"\n\t\"net\"\n\t\"time\"\n)\n\nconst packetSize = 64\n\nfunc main() {\n\t// Create two connection endpoints over UDP\n\tpacketConn, conn := createConnections()\n\n\t// Create a lossy packet connection\n\tbandwidth := 1048 // 8 Kbit/s\n\tminLatency := 100 * time.Millisecond\n\tmaxLatency := time.Second\n\tpacketLossRate := 0.33\n\theaderOverhead := lossy.UDPv4MinHeaderOverhead\n\tlossyPacketConn := lossy.NewPacketConn(packetConn, bandwidth, minLatency, maxLatency, packetLossRate, headerOverhead)\n\n\t// Write some packets via lossy\n\tvar bytesWritten int\n\tconst packetCount = 32\n\tgo func() {\n\t\tfor i := 0; i \u003c packetCount; i++ {\n\t\t\tpacket := createPacket()\n\t\t\t_, err := lossyPacketConn.WriteTo(packet, conn.LocalAddr())\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t\tbytesWritten += len(packet) + headerOverhead\n\t\t}\n\t\tfmt.Println(\"Sent\", packetCount, \"packets with total size of\", bytesWritten, \"bytes\")\n\t\tbaseTransmissionDuration := time.Duration(float64(bytesWritten * int(time.Second)) / float64(bandwidth))\n\t\tearliestCompletion := baseTransmissionDuration + minLatency\n\t\tlatestCompletion := baseTransmissionDuration + maxLatency\n\t\tfmt.Println(\"Expected transmission duration is between\", earliestCompletion, \"and\", latestCompletion)\n\t}()\n\n\t// Read packets at the other side\n\tconst timeout = 3 * time.Second\n\tvar packets, bytesRead int\n\tstartTime := time.Now()\n\tfor {\n\t\t_ = conn.SetReadDeadline(time.Now().Add(timeout))\n\t\tbuffer := make([]byte, packetSize)\n\t\tn, err := conn.Read(buffer)\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tbytesRead += n + headerOverhead\n\t\tpackets++\n\t}\n\tdur := time.Now().Sub(startTime) - timeout\n\tfmt.Println(\"Received\", packets, \"packets with total size of\", bytesRead, \"bytes in\", dur)\n\n\t// Close the connections\n\t_ = lossyPacketConn.Close()\n\t_ = conn.Close()\n}\n\nfunc createConnections() (net.PacketConn, net.Conn) {\n\tpacketConn, err := net.ListenUDP(\"udp\", \u0026net.UDPAddr{\n\t\tIP:   net.IPv4(127, 0, 0, 1),\n\t\tPort: 0,\n\t})\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tconn, err := net.DialUDP(\"udp\", nil, packetConn.LocalAddr().(*net.UDPAddr))\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn packetConn, conn\n}\n\nfunc createPacket() []byte {\n\tpacket := make([]byte, packetSize)\n\trand.Read(packet)\n\treturn packet\n}\n```\n\nOutput\n```\nSent 32 packets with total size of 2944 bytes\nExpected transmission duration is between 2.909160305s and 3.809160305s\nReceived 23 packets with total size of 2116 bytes in 3.2507523s\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcevatbarisyilmaz%2Flossy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcevatbarisyilmaz%2Flossy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcevatbarisyilmaz%2Flossy/lists"}