getlantern/flashlight — pull request #32 by oxtoacart (2014-10-15 14:05:46+00:00)
Title: 1606 ox

@atavism Nice work on the first cut of the natty integration! After reviewing, I've made some changes that seem more extensive than they actually are. The main improvements boil down to:

1. Put natty + waddell logic in the new project [nattywad](https://github.com/getlantern/nattywad), since this isn't flashlight specific and is thus best separated into its own module

2. Reorganized source to separate client and server-side processing, since these are pretty different. The common stuff is in common.go in nattywad.

3. Instead of maintaining global state in the nattywad (nee nattraversal) package, I've created Client and Server types that maintain their respective state.

4. I moved the udp testing logic out of that nattywad package and into its own nattest packate in flashlight. We hook into this using new OnFiveTuple callbacks on the nattywad Client and Server.

5. waddellConn now has logic that allows it to mimic a persistent connection to waddell, even if the underlying connection is lost. The only weird thing is that the peerid changes each time we reconnect, so we'll need to keep that in mind.

6. nattywad.Client and nattywad.Server now have Configure methods that are analogous to the ones on flashlight.Client and flashlight.Server, namely they handle initial and reconfiguration.

7. nattywad.Server uses a serverWorker to actually do its work. This way, if the configured waddellAddr changes, we avoid concurrency previous concurrency issues due to global state.

8. I started work on getting the flashlight client to communicate with waddell over a proxied connection, but this isn't working right now so I'll need to get back to it after we merge. This is important because otherwise the censors could just block waddell and we'd be dead in the water.