Module @libp2p/upnp-nat

The service exported by this module attempts to configure NAT hole punching via UPnP.

This will make your node publicly accessible from the internet.

For this to work there are some prerequisites:

  1. Your router must have UPnP support enabled
  2. Your libp2p node must be listening on a non-loopback IPv4 address
  3. You must not be double-NATed by your ISP

Example

import { createLibp2p } from 'libp2p'
import { tcp } from '@libp2p/tcp'
import { uPnPNAT } from '@libp2p/upnp-nat'

const node = await createLibp2p({
addresses: {
listen: [
'/ip4/0.0.0.0/tcp/0'
]
},
transports: [
tcp()
],
services: {
upnpNAT: uPnPNAT()
}
})

@libp2p/upnp-nat

libp2p.io Discuss codecov CI

UPnP NAT hole punching

About

The service exported by this module attempts to configure NAT hole punching via UPnP.

This will make your node publicly accessible from the internet.

For this to work there are some prerequisites:

  1. Your router must have UPnP support enabled
  2. Your libp2p node must be listening on a non-loopback IPv4 address
  3. You must not be double-NATed by your ISP

Example

import { createLibp2p } from 'libp2p'
import { tcp } from '@libp2p/tcp'
import { uPnPNAT } from '@libp2p/upnp-nat'

const node = await createLibp2p({
addresses: {
listen: [
'/ip4/0.0.0.0/tcp/0'
]
},
transports: [
tcp()
],
services: {
upnpNAT: uPnPNAT()
}
})

Install

$ npm i @libp2p/upnp-nat

API Docs

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Index

Interfaces

Functions