{"id":20388239,"url":"https://github.com/libp2p/go-libp2p-http","last_synced_at":"2025-05-15T17:08:29.836Z","repository":{"id":16924564,"uuid":"80877872","full_name":"libp2p/go-libp2p-http","owner":"libp2p","description":"HTTP on top of libp2p","archived":false,"fork":false,"pushed_at":"2025-03-29T08:32:24.000Z","size":301,"stargazers_count":66,"open_issues_count":4,"forks_count":19,"subscribers_count":21,"default_branch":"master","last_synced_at":"2025-04-07T23:08:34.972Z","etag":null,"topics":["go","http","ipfs","libp2p"],"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/libp2p.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":"2017-02-03T23:22:18.000Z","updated_at":"2025-04-02T06:59:04.000Z","dependencies_parsed_at":"2024-03-21T15:58:31.731Z","dependency_job_id":"27a63f89-159a-4419-a096-e88061de7412","html_url":"https://github.com/libp2p/go-libp2p-http","commit_stats":{"total_commits":116,"total_committers":16,"mean_commits":7.25,"dds":0.5172413793103448,"last_synced_commit":"0cd6d343d0d1f510219704443aec10352953e900"},"previous_names":["hsanjuan/go-libp2p-http"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fgo-libp2p-http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fgo-libp2p-http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fgo-libp2p-http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/libp2p%2Fgo-libp2p-http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/libp2p","download_url":"https://codeload.github.com/libp2p/go-libp2p-http/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254384988,"owners_count":22062422,"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","http","ipfs","libp2p"],"created_at":"2024-11-15T03:08:11.494Z","updated_at":"2025-05-15T17:08:24.820Z","avatar_url":"https://github.com/libp2p.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-libp2p-http\n\n[![Build Status](https://travis-ci.org/libp2p/go-libp2p-http.svg?branch=master)](https://travis-ci.org/libp2p/go-libp2p-http)\n[![codecov](https://codecov.io/gh/libp2p/go-libp2p-http/branch/master/graph/badge.svg)](https://codecov.io/gh/libp2p/go-libp2p-http)\n[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg)](https://github.com/RichardLitt/standard-readme)\n\n\n\u003e HTTP on top of libp2p\n\nPackage `p2phttp` allows to serve HTTP endpoints and make HTTP requests through [libp2p](https://github.com/libp2p/libp2p) using Go's standard \"http\" and \"net\" stack.\n\nInstead of the regular \"host:port\" addressing, `p2phttp` uses a Peer ID and lets libp2p take care of the routing, thus taking advantage of features like multi-routes,  NAT transversal and stream multiplexing over a single connection.\n\n## Table of Contents\n\n- [Install](#install)\n- [Usage](#usage)\n- [Contribute](#contribute)\n- [License](#license)\n\n## Install\n\nThis package is a library that uses Go modules for dependency management.\n\n## Usage\n\nFull documentation can be read at [Godoc](https://godoc.org/github.com/libp2p/go-libp2p-http). The important bits follow.\n\nA simple `http.Server` on libp2p works as:\n\n```go\nlistener, _ := gostream.Listen(host1, p2phttp.DefaultP2PProtocol)\ndefer listener.Close()\ngo func() {\n\thttp.HandleFunc(\"/hello\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Write([]byte(\"Hi!\"))\n\t})\n\tserver := \u0026http.Server{}\n\tserver.Serve(listener)\n}()\n```\n\nThe listener is provided by https://github.com/libp2p/go-libp2p-gostream .\n\nA client just needs to be initialized with a custom libp2p host-based transport to perform requests to such server:\n\n```go\ntr := \u0026http.Transport{}\ntr.RegisterProtocol(\"libp2p\", p2phttp.NewTransport(clientHost))\nclient := \u0026http.Client{Transport: tr}\nres, err := client.Get(\"libp2p://Qmaoi4isbcTbFfohQyn28EiYM5CDWQx9QRCjDh3CTeiY7P/hello\")\n```\n\n## Contribute\n\nPRs accepted.\n\n## License\n\nMIT © Protocol Labs, Inc.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibp2p%2Fgo-libp2p-http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flibp2p%2Fgo-libp2p-http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flibp2p%2Fgo-libp2p-http/lists"}