Skip to content

Go language wrapper around the natty NAT-traversal utility

License

Notifications You must be signed in to change notification settings

GaijinKa/go-natty

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Go language wrapper around the natty NAT-traversal utility

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%