Commit graph

23 commits

Author SHA1 Message Date
David Fifield
b48fb781ee Have util.{Serialize,Deserialize}SessionDescription return an error
https://bugs.torproject.org/33897#comment:4
2020-04-27 18:46:56 -06:00
David Fifield
70126177fb Turbo Tunnel client and server.
The client opts into turbotunnel mode by sending a magic token at the
beginning of each WebSocket connection (before sending even the
ClientID). The token is just a random byte string I generated. The
server peeks at the token and, if it matches, uses turbotunnel mode.
Otherwise, it unreads the token and continues in the old
one-session-per-WebSocket mode.
2020-04-23 16:02:56 -06:00
David Fifield
222ab3d85a Import Turbo Tunnel support code.
Copied and slightly modified from
https://gitweb.torproject.org/pluggable-transports/meek.git/log/?h=turbotunnel&id=7eb94209f857fc71c2155907b0462cc587fc76cc
https://github.com/net4people/bbs/issues/21

RedialPacketConn is adapted from clientPacketConn in
c64a61c6da/obfs4proxy/turbotunnel_client.go
https://github.com/net4people/bbs/issues/14#issuecomment-544747519
2020-04-23 14:00:03 -06:00
Arlo Breault
670e4ba438 Move StripLocalAddresses to a common util
Trac: 19026
2020-03-26 13:13:15 -04:00
Arlo Breault
d10af300c1 Refactor (De)SerializeSessionDescription as common utils 2020-03-17 20:16:58 -04:00
David Fifield
380b133155 Close internal Pipes in websocketconn.Conn Close.
Unless something externally called Write after Close, the
writeLoop(ws, pr2) goroutine would run forever, because nothing would
ever close pw2/pr2.
https://bugs.torproject.org/33367#comment:4
2020-02-18 14:10:47 -07:00
Arlo Breault
28cf70bb44 Remove unreachable code
go vet was complaining,

common/websocketconn/websocketconn.go:56:2: unreachable code
2020-02-08 10:12:43 -05:00
David Fifield
256959ca65 Implement net.Conn for websocketconn.Conn.
We had already implemented Read, Write, and Close. Pass RemoteAddr,
LocalAddr, SetReadDeadline, and SetWriteDeadline through to the
underlying *websocket.Conn. Implement SetDeadline by calling both
SetReadDeadline and SetWriteDeadline.

https://bugs.torproject.org/33144
2020-02-04 15:53:15 -07:00
David Fifield
01e28aa460 Rewrite websocketconn with synchronous pipes.
Makes the following changes:
 * permits concurrent Read/Write/Close
 * converts certain CloseErrors into io.EOF

https://bugs.torproject.org/33144
2020-02-04 15:53:15 -07:00
David Fifield
5708a1d57b websocketconn tests.
https://bugs.torproject.org/33144
2020-02-04 15:53:15 -07:00
David Fifield
20ac2029fd Have websocketconn.New return a pointer.
This makes the return type satisfy the io.ReadWriteCloser interface
directly.
2020-01-30 10:18:23 -07:00
David Fifield
e47dd5e2b4 Remove some redundancy in websocketconn naming.
Rename websocketconn.WebSocketConn to websocketconn.Conn, and
       websocketconn.NewWebSocketConn to websocketconn.New

Following the guidelines at
https://blog.golang.org/package-names#TOC_3%2e
2020-01-30 10:18:23 -07:00
Cecylia Bocovich
3bdcc3408e Increased test coverage for messages library 2019-12-06 11:30:34 -05:00
Cecylia Bocovich
94de69aa36 Updated broker specification and comments 2019-11-28 13:52:58 -05:00
Cecylia Bocovich
97554e03e4 Updated proxyType variable name for readability 2019-11-28 13:52:58 -05:00
Cecylia Bocovich
7277bb37cd Update broker--proxy protocol with proxy type
Proxies now include information about what type they are when they poll
for client offers. The broker saves this information along with
snowflake ids and outputs it on the /debug page.
2019-11-28 13:52:58 -05:00
Arlo Breault
7092b2cb2c Revert abstracting copyloop 2019-11-21 19:33:39 -05:00
Arlo Breault
30b5ef8a9e Use gorilla websocket in proxy-go too
Trac: 32465
2019-11-20 19:33:28 -05:00
Cecylia Bocovich
b4b538a17f Implemented new broker messages for browser proxy 2019-11-13 10:54:48 -05:00
Cecylia Bocovich
c4ae64905b Redo protocol for proxy--broker messages
Switch to containing all communication between the proxy and the broker
in the HTTP response body. This will make things easier if we ever use
something other than HTTP communicate between different actors in the
snowflake system.

Other changes to the protocol are as follows:
- requests are accompanied by a version number so the broker can be
backwards compatable if desired in the future
- all responses are 200 OK unless the request was badly formatted
2019-11-13 10:54:48 -05:00
Cecylia Bocovich
3c28380bc6 Add locks to safelog
The safelog Write function can be called from multiple go routines, and
it was not thread safe. These locks in particular allow us to pass the
logscrubber's output io.Writer to other libraries, such as pion.
2019-09-30 16:43:51 -04:00
Cecylia Bocovich
83fb5df260 Fixed log scrubber to not scrub timestamps
Our log scrubber was a bit over-zealous and was scrubbing timestamps as
well. While we're still over-scrubbing, we're now more precise and
ensure that compressed IPv6 addresses have "::"
2019-05-08 12:31:53 -04:00
Cecylia Bocovich
49042511a3 Refactored server log scrubber into package
The server log scrubbing code from ticket #21304 is now refactored into
a safelog package, along with the appropriate tests
2019-04-11 14:43:59 -04:00