{"id":26223430,"url":"https://github.com/inet256/go-utp","last_synced_at":"2026-02-27T21:06:47.489Z","repository":{"id":65331203,"uuid":"589754029","full_name":"inet256/go-utp","owner":"inet256","description":"uTP: Micro Transport Protocol in Go","archived":false,"fork":false,"pushed_at":"2023-01-22T19:27:34.000Z","size":379,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T07:21:49.751Z","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":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inet256.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":"2023-01-16T21:21:24.000Z","updated_at":"2023-09-27T16:03:23.000Z","dependencies_parsed_at":"2023-02-12T18:00:23.430Z","dependency_job_id":null,"html_url":"https://github.com/inet256/go-utp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inet256%2Fgo-utp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inet256%2Fgo-utp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inet256%2Fgo-utp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inet256%2Fgo-utp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inet256","download_url":"https://codeload.github.com/inet256/go-utp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249685167,"owners_count":21310557,"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":[],"created_at":"2025-03-12T17:33:36.167Z","updated_at":"2026-02-27T21:06:42.471Z","avatar_url":"https://github.com/inet256.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go μTP\n[![GoDoc](https://godoc.org/github.com/inet256/go-utp?status.svg)](https://godoc.org/github.com/inet256/go-utp)\n\nGo implementation of the [Micro Transport Protocol](https://en.wikipedia.org/wiki/Micro_Transport_Protocol).\n\n## Getting Started\nFirst you will need a `net.PacketConn`.\nThis can be anything implementing the interface.\nThere are no abstraction-breaking checks for a particular implementation.\nThen use `utp.NewSocket` to get started.\n\n```go\nfunc createSocket() *utp.Socket {\n    // Create a UDP socket listening on all addresses\n    pc, err := net.ListenPacket(\"udp\", \"0.0.0.0:0\")\n    if err != nil {\n        panic(err)\n    }\n\n    // Call utp.New to create a *utp.Socket from the net.PacketConn\n    s := utp.NewSocket(pc)\n    return s\n}\n\n// As a server\nfunc useAsServer(s *utp.Socket) error {\n    for {\n        conn, err := s.Accept()\n        go func() {\n            defer conn.Close()\n            // handle the conn\n        }\n    }\n}\n\n// As a client\nfunc useAsClient(s *utp.Socket, raddr net.Addr) error {\n    conn, err := s.DialContext(ctx, raddr)\n    if err != nil {\n        return err\n    }\n    defer conn.Close\n    // send some data to the other party\n    _, err := conn.Write([]byte(\"hello world\"))\n    return err\n}\n```\n\n### Instrumentation\nAll logging and metrics are provided by the [stdctx](https://github.com/brendoncarroll/stdctx) library.\nIf you want logs or metrics just configure a context as described there, and pass it in.\n\n## Contributing\n`just` is used to run commands.\n\n`just test` runs the tests.\n\nContributions are welcome.\n\n## Roadmap\nLong term it would be best for the implementation to change to be more testable.\nThe `Socket` and `Conn` objects are the right API (adhearing to `net.Listener`/`net.Dialer` and `net.Conn` respectively), but they are difficult to test.\nThere needs to be a state machine object, which doesn't have go routines or timers internally, so that arbitrary stimulus at arbitrary states can be tested.\n\n## Fork\nOrginally forked from `github.com/anacrolix/utp`.\nThere were a number of reasons for forking:\n- The pure go implementation is deprecated in favor of a C-Go port of libutp.  This fork will continue to be pure Go.\n- The API was very UDP specifc, taking string addresses in several places.\n- Legacy logging, and instrumentation.\n- High quality user experience on top of INET256.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finet256%2Fgo-utp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finet256%2Fgo-utp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finet256%2Fgo-utp/lists"}