All Projects → multiformats → py-multiaddr

multiformats / py-multiaddr

Licence: Unknown and 2 other licenses found Licenses found Unknown COPYRIGHT Unknown LICENSE-APACHE2 MIT LICENSE-MIT
multiaddr implementation in Python

Programming Languages

python
139335 projects - #7 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to py-multiaddr

go-libp2p-quic-transport
An implementation of a libp2p transport using QUIC
Stars: ✭ 102 (+277.78%)
Mutual labels:  ipfs, libp2p
Js Libp2p
The JavaScript Implementation of libp2p networking stack.
Stars: ✭ 1,686 (+6144.44%)
Mutual labels:  ipfs, libp2p
Ipfs
Peer-to-peer hypermedia protocol
Stars: ✭ 20,128 (+74448.15%)
Mutual labels:  ipfs, multiformats
go-libp2p-tor-transport
🚧 WIP: tor transport for libp2p
Stars: ✭ 41 (+51.85%)
Mutual labels:  ipfs, libp2p
web3.storage
⁂ The simple file storage service for IPFS & Filecoin
Stars: ✭ 417 (+1444.44%)
Mutual labels:  ipfs, libp2p
hydra-booster
A DHT Indexer node & Peer Router
Stars: ✭ 56 (+107.41%)
Mutual labels:  ipfs, libp2p
Js Ipfs
IPFS implementation in JavaScript
Stars: ✭ 6,129 (+22600%)
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 (-7.41%)
Mutual labels:  ipfs, libp2p
peer-id-generator
Vanity public key generator for use with IPFS and IPNS
Stars: ✭ 27 (+0%)
Mutual labels:  ipfs, libp2p
go-libp2p-http
HTTP on top of libp2p
Stars: ✭ 49 (+81.48%)
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 (+18792.59%)
Mutual labels:  ipfs, libp2p
nebula-crawler
🌌 A libp2p DHT crawler, monitor, and measurement tool that exposes timely information about DHT networks.
Stars: ✭ 97 (+259.26%)
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 (+725.93%)
Mutual labels:  ipfs, libp2p
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 (+70.37%)
Mutual labels:  ipfs, libp2p
go-ipfs-recovery
Data recovery for IPFS protocol.
Stars: ✭ 16 (-40.74%)
Mutual labels:  ipfs, libp2p
js-ipfs-mfs
[ARCHIVED] now part of the https://github.com/ipfs/js-ipfs repo
Stars: ✭ 27 (+0%)
Mutual labels:  ipfs
js-ipfs-utils
IPFS utils
Stars: ✭ 17 (-37.04%)
Mutual labels:  ipfs
lucky
Proof of luck Intel SGX and IPFS based blockchain.
Stars: ✭ 70 (+159.26%)
Mutual labels:  ipfs
learnp2p
https://learnp2p.org
Stars: ✭ 22 (-18.52%)
Mutual labels:  libp2p
sharding-p2p-poc
Proof of Concept of Ethereum Serenity Peer-to-Peer Layer on libp2p PubSub System
Stars: ✭ 35 (+29.63%)
Mutual labels:  libp2p

py-multiaddr

https://api.travis-ci.com/multiformats/py-multiaddr.svg?branch=master https://codecov.io/github/multiformats/py-multiaddr/coverage.svg?branch=master Documentation Status
multiaddr implementation in Python

Usage

Simple

from multiaddr import Multiaddr

# construct from a string
m1 = Multiaddr("/ip4/127.0.0.1/udp/1234")

# construct from bytes
m2 = Multiaddr(bytes_addr=m1.to_bytes())

assert str(m1) == "/ip4/127.0.0.1/udp/1234"
assert str(m1) == str(m2)
assert m1.to_bytes() == m2.to_bytes()
assert m1 == m2
assert m2 == m1
assert not (m1 != m2)
assert not (m2 != m1)

Protocols

from multiaddr import Multiaddr

m1 = Multiaddr("/ip4/127.0.0.1/udp/1234")

# get the multiaddr protocol description objects
m1.protocols()
# [Protocol(code=4, name='ip4', size=32), Protocol(code=17, name='udp', size=16)]

En/decapsulate

from multiaddr import Multiaddr

m1 = Multiaddr("/ip4/127.0.0.1/udp/1234")
m1.encapsulate(Multiaddr("/sctp/5678"))
# <Multiaddr /ip4/127.0.0.1/udp/1234/sctp/5678>
m1.decapsulate(Multiaddr("/udp"))
# <Multiaddr /ip4/127.0.0.1>

Tunneling

Multiaddr allows expressing tunnels very nicely.

printer = Multiaddr("/ip4/192.168.0.13/tcp/80")
proxy = Multiaddr("/ip4/10.20.30.40/tcp/443")
printerOverProxy = proxy.encapsulate(printer)
print(printerOverProxy)
# /ip4/10.20.30.40/tcp/443/ip4/192.168.0.13/tcp/80

proxyAgain = printerOverProxy.decapsulate(printer)
print(proxyAgain)
# /ip4/10.20.30.40/tcp/443

Maintainers

Original author: @sbuss.

Contribute

Contributions welcome. Please check out the issues.

Check out our contributing document for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS Code of Conduct.

License

Dual-licensed:

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