GithubHelp home page GithubHelp logo

chi-lambda / open.nat Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lontivero/open.nat

0.0 2.0 0.0 4.75 MB

Lightweight and easy-to-use class library to allow port forwarding in NAT devices with UPNP and/or PMP

License: MIT License

C# 99.81% Batchfile 0.19%

open.nat's Introduction

Logo

Open.NAT

Open.NAT is a lightweight and easy-to-use class library to allow port forwarding in NAT devices that support UPNP (Universal Plug & Play) and/or PMP (Port Mapping Protocol).

Goals

NATed computers cannot be reached from outside and this is particularly painful for peer-to-peer or friend-to-friend software. The main goal is to simplify communication amoung computers behind NAT devices that support UPNP and/or PMP providing a clean and easy interface to get the external IP address and map ports and helping you to achieve peer-to-peer communication.

  • Tested with .NET YES
  • Tested with Mono YES

How to use?

With nuget :

Install-Package Open.NAT

Go on the nuget website for more information.

Example

The simplest scenario:

var discoverer = new NatDiscoverer();
var device = await discoverer.DiscoverDeviceAsync();
var ip = await device.GetExternalIPAsync();
Console.WriteLine("The external IP Address is: {0} ", ip);

The following piece of code shows a common scenario: It starts the discovery process for a NAT-UPNP device and onces discovered it creates a port mapping. If no device is found before ten seconds, it fails with NatDeviceNotFoundException.

var discoverer = new NatDiscoverer();
var cts = new CancellationTokenSource(10000);
var device = await discoverer.DiscoverDeviceAsync(PortMapper.Upnp, cts);

await device.CreatePortMapAsync(new Mapping(Protocol.Tcp, 1600, 1700, "The mapping name"));

For more info please check the Wiki

Awesome software using Open.NAT

Documentation

Development

Open.NAT is been developed by Lucas Ontivero (@lontivero). You are welcome to contribute code. You can send code both as a patch or a GitHub pull request.

Here you can see what are the next features to implement. Take it a look! Build Status

Build status

NuGet version

##Help me to maintain Open.NAT

Bitcoin address

15fdF4xeZBZMqj8ybrrW7L392gZbx4sCXH

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.