{"id":13615117,"url":"https://github.com/kavu/go_reuseport","last_synced_at":"2025-04-13T20:33:04.645Z","repository":{"id":15081640,"uuid":"17808068","full_name":"kavu/go_reuseport","owner":"kavu","description":"Brings SO_REUSEPORT into your Go server","archived":false,"fork":false,"pushed_at":"2021-04-28T20:14:20.000Z","size":54,"stargazers_count":568,"open_issues_count":1,"forks_count":70,"subscribers_count":22,"default_branch":"master","last_synced_at":"2024-08-02T20:46:46.059Z","etag":null,"topics":["go"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"sheebz/phantom-proxy","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kavu.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":"2014-03-16T20:09:22.000Z","updated_at":"2024-07-15T04:30:24.000Z","dependencies_parsed_at":"2022-08-02T18:01:25.297Z","dependency_job_id":null,"html_url":"https://github.com/kavu/go_reuseport","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kavu%2Fgo_reuseport","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kavu%2Fgo_reuseport/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kavu%2Fgo_reuseport/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kavu%2Fgo_reuseport/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kavu","download_url":"https://codeload.github.com/kavu/go_reuseport/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223605570,"owners_count":17172504,"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"],"created_at":"2024-08-01T20:01:09.560Z","updated_at":"2024-11-07T23:30:45.697Z","avatar_url":"https://github.com/kavu.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# GO_REUSEPORT\n\n[![Build Status](https://travis-ci.org/kavu/go_reuseport.png?branch=master)](https://travis-ci.org/kavu/go_reuseport)\n[![codecov](https://codecov.io/gh/kavu/go_reuseport/branch/master/graph/badge.svg)](https://codecov.io/gh/kavu/go_reuseport)\n[![GoDoc](https://godoc.org/github.com/kavu/go_reuseport?status.png)](https://godoc.org/github.com/kavu/go_reuseport)\n\n**GO_REUSEPORT** is a little expirement to create a `net.Listener` that supports [SO_REUSEPORT](http://lwn.net/Articles/542629/) socket option.\n\nFor now, Darwin and Linux (from 3.9) systems are supported. I'll be pleased if you'll test other systems and tell me the results.\n documentation on [godoc.org](http://godoc.org/github.com/kavu/go_reuseport \"go_reuseport documentation\").\n\n## Example ##\n\n```go\npackage main\n\nimport (\n  \"fmt\"\n  \"html\"\n  \"net/http\"\n  \"os\"\n  \"runtime\"\n  \"github.com/kavu/go_reuseport\"\n)\n\nfunc main() {\n  listener, err := reuseport.Listen(\"tcp\", \"localhost:8881\")\n  if err != nil {\n    panic(err)\n  }\n  defer listener.Close()\n\n  server := \u0026http.Server{}\n  http.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n    fmt.Println(os.Getgid())\n    fmt.Fprintf(w, \"Hello, %q\\n\", html.EscapeString(r.URL.Path))\n  })\n\n  panic(server.Serve(listener))\n}\n```\n\nNow you can run several instances of this tiny server without `Address already in use` errors.\n\n## Thanks\n\nInspired by [Artur Siekielski](https://github.com/aartur) [post](http://freeprogrammersblog.vhex.net/post/linux-39-introdued-new-way-of-writing-socket-servers/2) about `SO_REUSEPORT`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkavu%2Fgo_reuseport","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkavu%2Fgo_reuseport","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkavu%2Fgo_reuseport/lists"}