Coder Social home page Coder Social logo

go-natty's Introduction

go-natty Travis CI Status Coverage Status GoDoc

go-natty provides a Go wrapper around the natty NAT-traversal utility.

To install:

go get github.com/getlantern/go-natty

For docs:

godoc github.com/getlantern/go-natty/natty

Embedding Natty

To build the go files that embed the natty executables for different platforms, just place the binaries into the right subfolder of binaries and then run embednatty.bash. This script takes care of code signing the Windows and OS X executables.

This script signs the Windows executable, which requires that osslsigncode utility be installed. On OS X with homebrew, you can do this with brew install osslsigncode.

You will also need to set the environment variables BNS_CERT and BNS_CERT_PASS to point to bns-cert.p12 and its password so that the script can sign the Windows executable.

This script also signs the OS X executable, which requires you to our OS X signing certificate, available here. The password is here.

Demo

There's a demo application available. You can build it from inside the demo folder by running go build . which will create a demo executable.

The client and server signal with each other using waddell and the client sends UDP packets to the server once NAT-traversal is complete. The client finds the server on waddell using its waddell id.

Example Demo Session

Server

Macintosh% ./natty-demo-osx -mode server                                                            
2014/09/16 18:41:36 Starting server, waddell id is "e6679a41-0003-4f9b-8ae4-671a8a196d13"
2014/09/16 18:41:49 Got five tuple: &{udp 192.168.1.160:55285 192.168.1.160:60530}
2014/09/16 18:41:49 Listening for UDP packets at: 192.168.1.160:55285
2014/09/16 18:41:49 Got UDP message from 192.168.1.160:60530: 'Hello from 192.168.1.160:60530'
2014/09/16 18:41:50 Got UDP message from 192.168.1.160:60530: 'Hello from 192.168.1.160:60530'
2014/09/16 18:41:51 Got UDP message from 192.168.1.160:60530: 'Hello from 192.168.1.160:60530'
2014/09/16 18:41:52 Got UDP message from 192.168.1.160:60530: 'Hello from 192.168.1.160:60530'

Note - you have to specify the waddell id emitted by the server when running the client.

Client

Macintosh% ./natty-demo-osx -mode client -server "e6679a41-0003-4f9b-8ae4-671a8a196d13"
2014/09/16 18:41:46 Starting client, connecting to server e6679a41-0003-4f9b-8ae4-671a8a196d13 ...
2014/09/16 18:41:48 Got five tuple: &{udp 192.168.1.160:60530 192.168.1.160:55285}
2014/09/16 18:41:49 Sending UDP message: Hello from 192.168.1.160:60530
2014/09/16 18:41:50 Sending UDP message: Hello from 192.168.1.160:60530
2014/09/16 18:41:51 Sending UDP message: Hello from 192.168.1.160:60530
2014/09/16 18:41:52 Sending UDP message: Hello from 192.168.1.160:60530

Acknowledgements:

go-natty is just a wrapper around natty, which is itself just a wrapper around the WebRTC Native Code Package.

go-natty's People

Contributors

oxtoacart avatar aranhoide avatar myleshorton avatar

Watchers

cuiwm avatar  avatar

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.