All Projects → libp2p → go-libp2p-http

libp2p / go-libp2p-http

Licence: MIT license
HTTP on top of libp2p

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to go-libp2p-http

ipfs-crawler
A crawler for the IPFS network, code for our paper (https://arxiv.org/abs/2002.07747). Also holds scripts to evaluate the obtained data and make similar plots as in the paper.
Stars: ✭ 46 (-6.12%)
Mutual labels:  ipfs, libp2p
edgevpn
⛵ The immutable, decentralized, statically built p2p VPN without any central server and automatic discovery! Create decentralized introspectable tunnels over p2p with shared tokens
Stars: ✭ 223 (+355.1%)
Mutual labels:  ipfs, libp2p
nebula-crawler
🌌 A libp2p DHT crawler, monitor, and measurement tool that exposes timely information about DHT networks.
Stars: ✭ 97 (+97.96%)
Mutual labels:  ipfs, libp2p
go-ipfs-recovery
Data recovery for IPFS protocol.
Stars: ✭ 16 (-67.35%)
Mutual labels:  ipfs, libp2p
go-libp2p-quic-transport
An implementation of a libp2p transport using QUIC
Stars: ✭ 102 (+108.16%)
Mutual labels:  ipfs, libp2p
web3.storage
⁂ The simple file storage service for IPFS & Filecoin
Stars: ✭ 417 (+751.02%)
Mutual labels:  ipfs, libp2p
py-multiaddr
multiaddr implementation in Python
Stars: ✭ 27 (-44.9%)
Mutual labels:  ipfs, libp2p
peer-id-generator
Vanity public key generator for use with IPFS and IPNS
Stars: ✭ 27 (-44.9%)
Mutual labels:  ipfs, libp2p
hydra-booster
A DHT Indexer node & Peer Router
Stars: ✭ 56 (+14.29%)
Mutual labels:  ipfs, libp2p
borg
Client-server stack for Web3! Turn your Raspberry Pi to a BAS server in minutes and enjoy the freedom of decentralized Web with a superior user experience!
Stars: ✭ 25 (-48.98%)
Mutual labels:  ipfs, libp2p
go-libp2p-tor-transport
🚧 WIP: tor transport for libp2p
Stars: ✭ 41 (-16.33%)
Mutual labels:  ipfs, libp2p
Js Ipfs
IPFS implementation in JavaScript
Stars: ✭ 6,129 (+12408.16%)
Mutual labels:  ipfs, libp2p
Berty
Berty is a secure peer-to-peer messaging app that works with or without internet access, cellular data or trust in the network
Stars: ✭ 5,101 (+10310.2%)
Mutual labels:  ipfs, libp2p
Js Libp2p
The JavaScript Implementation of libp2p networking stack.
Stars: ✭ 1,686 (+3340.82%)
Mutual labels:  ipfs, libp2p
Aya
your globally distributed waifu storage
Stars: ✭ 32 (-34.69%)
Mutual labels:  ipfs
django-ipfs-storage
IPFS storage backend for Django.
Stars: ✭ 26 (-46.94%)
Mutual labels:  ipfs
go-ipns
Utilities for creating, parsing, and validating IPNS records
Stars: ✭ 35 (-28.57%)
Mutual labels:  ipfs
prometheus-spec
Censorship-resistant trustless protocols for smart contract, generic & high-load computing & machine learning on top of Bitcoin
Stars: ✭ 24 (-51.02%)
Mutual labels:  ipfs
dapps.earth
Source code for dapps.earth: IPFS and Swarm gateway
Stars: ✭ 12 (-75.51%)
Mutual labels:  ipfs
ipfs-pubsub-chatroom
Simple IPFS Pubsub chatroom built on React
Stars: ✭ 45 (-8.16%)
Mutual labels:  ipfs

go-libp2p-http

Build Status codecov standard-readme compliant

HTTP on top of libp2p

Package p2phttp allows to serve HTTP endpoints and make HTTP requests through libp2p using Go's standard "http" and "net" stack.

Instead 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.

Table of Contents

Install

This package is a library that uses Go modules for dependency management.

Usage

Full documentation can be read at Godoc. The important bits follow.

A simple http.Server on libp2p works as:

listener, _ := gostream.Listen(host1, p2phttp.DefaultP2PProtocol)
defer listener.Close()
go func() {
	http.HandleFunc("/hello", func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte("Hi!"))
	})
	server := &http.Server{}
	server.Serve(listener)
}

The listener is provided by https://github.com/libp2p/go-libp2p-gostream .

A client just needs to be initialized with a custom libp2p host-based transport to perform requests to such server:

tr := &http.Transport{}
tr.RegisterProtocol("libp2p", p2phttp.NewTransport(clientHost))
client := &http.Client{Transport: tr}
res, err := client.Get("libp2p://Qmaoi4isbcTbFfohQyn28EiYM5CDWQx9QRCjDh3CTeiY7P/hello")

Contribute

PRs accepted.

License

MIT © Protocol Labs, Inc.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].