Commit graph

245 commits

Author SHA1 Message Date
David Fifield
1eb5c66428 Stop writing to global opt.brokerURL variable.
This variable was being written to by multiple goroutines, overwriting
the Path to either "/proxy" or "/answer" as necessary, which was racy.
2017-08-01 15:51:34 -07:00
David Fifield
461dbeba80 Make capacity a uint.
This prohibits some nonsense like "./proxy-go -capacity -550", which
otherwise results in a panic like:

INFO: configuration.go:174: Created Configuration at  &{[{[stun:stun.l.google.com:19302]  }] All Balanced }
panic: makechan: size out of range
2017-08-01 15:06:53 -07:00
David Fifield
dbe1ef4fa5 Remove unused stunURL and relayURL, unused except for parsing tests. 2017-08-01 10:55:14 -07:00
David Fifield
5440a4ba16 fmt 2017-07-25 18:59:15 -07:00
David Fifield
db2251345d Close the log file in server. 2017-07-16 15:03:56 -07:00
David Fifield
9ebde38b3f Add a -log option to server-webrtc. 2017-07-16 15:02:41 -07:00
David Fifield
86a244c39e Make client and server-webrtc log in UTC. 2017-07-16 14:58:34 -07:00
David Fifield
0ccb4b7cc8 Have embed.html refresh itself once a day.
This is a hedge against any bugs that may cause the badge to hang when
left running for a long time, and it also means that badges will
effectively check for updated code once a day.
2017-07-15 14:38:01 -07:00
David Fifield
2a46db2c01 Remove broker /ip endpoint.
Doesn't seem to be used anywhere; may have been inherited from flash
proxy.
2017-07-15 14:34:18 -07:00
David Fifield
2242be7a55 Have the broker log in UTC. 2017-07-14 20:07:50 -07:00
David Fifield
f2ee53e42e Use https links for keroserene.net. 2017-07-14 18:36:44 -07:00
David Fifield
bfea72b50e Have proxy-go log in UTC. 2017-06-29 16:44:17 -07:00
David Fifield
b0dbf47473 Move some default config into constants at the stop. 2017-06-29 16:11:03 -07:00
David Fifield
c2c1a9d09d Enable proxy-go to create its log file. 2017-06-29 16:09:25 -07:00
David Fifield
faeb8da8c9 Use crypto/rand, not math/rand, to generate session IDs.
math/rand always uses a deterministic seed. The sequence of session IDs
was therefore always the same:
	Uv38ByGCZU8WP18PmmIdcg
	lWbHTRDYaB0NhtHpHgAWeQ
	...

Multiple copies of this program would have had session ID collisions. I
don't know what the consequences of that would be.
2017-06-29 16:00:29 -07:00
David Fifield
af8a026991 Improve some error messages. 2017-06-29 15:59:07 -07:00
David Fifield
12922a232b Make logging optional and controlled by a -log option. 2017-06-29 15:46:57 -07:00
David Fifield
f418ec7a85 Handle TOR_PT_EXIT_ON_STDIN_CLOSE. 2017-06-29 15:28:27 -07:00
David Fifield
1fa9bc051c Remove SIGINT handling (no longer part of pt-spec). 2017-06-29 15:20:54 -07:00
David Fifield
c3f87281be Add -log option to proxy-go. 2017-06-29 15:11:14 -07:00
David Fifield
62f50b29b2 Minimal README for proxy-go. 2017-05-04 01:19:42 -07:00
yinghuocho
4b5794c935 Golang implementation of standalone snowflake proxy 2017-04-24 16:16:02 -07:00
David Fifield
61b604fc46 Merge branch 'letsencrypt' 2017-03-30 19:13:01 -07:00
Serene H
9f2e9a6ecb disable for TBB user agents. closes #37 2017-03-01 19:09:24 -08:00
Serene H
6d2b0ac420 move disable check to snowflakeIsDisabled 2017-03-01 18:51:24 -08:00
Serene H
3fe10f3e7c default to wss and some documentation updates, #40 2017-02-28 22:46:39 -08:00
Arlo Breault
d1ec51bfb9 Remove unused clientAddr from ProxyPair 2017-01-23 12:34:08 -08:00
Arlo Breault
5212eda6b2 Fix logging inactive to ui 2017-01-23 12:01:23 -08:00
David Fifield
a936fc7e9b README and documentation for server. 2017-01-21 14:53:51 -08:00
David Fifield
1f8be86a01 Add a DirCache for certificates under TOR_PT_STATE_LOCATION.
This way, we don't lose state of certificates every time the process is
restarted. There's a possibility, otherwise, that if you have to restart
the server rapidly, you might run into Let's Encrypt rate limits and be
unable to create a cert for a while.
https://godoc.org/rsc.io/letsencrypt#hdr-Persistent_Storage
2017-01-21 14:23:15 -08:00
David Fifield
b0826304a4 Make certManager a pointer and only set it when !disableTLS. 2017-01-21 14:01:43 -08:00
David Fifield
138d2b5391 Use websocket relay at wss://snowflake.bamsoftware.com:443. 2017-01-20 19:17:08 -08:00
David Fifield
1b1fb37afe Add "hostname" args to the bridge descriptor as well. 2017-01-20 19:17:08 -08:00
David Fifield
80acfbd8d8 Explain more in usage. 2017-01-20 19:17:08 -08:00
David Fifield
b86bbd748d Add --acme-email option. 2017-01-20 19:17:08 -08:00
David Fifield
61310600c3 Automatically fetch certificates from Let's Encrypt.
This removes the --tls-cert and --tls-keys options and replaces them
with --acme-hostname and (optional) --acme-email. It uses
https://godoc.org/golang.org/x/crypto/acme/autocert, which is kind of a
successor to https://godoc.org/rsc.io/letsencrypt.

The autocert package only works when the listener runs on port 443. For
that reason, if TOR_PT_SERVER_BINDADDR asks for a port other than 443,
the program will open an *additional* listening port on 443. If there is
an error opening the listener, it is reported through an SMETHOD-ERROR
for the requested address.

The inspiration for this code came from George Tankersley's patch for
meek-server:
https://bugs.torproject.org/18655#comment:8
https://github.com/gtank/meek/tree/letsencrypt
2017-01-20 19:17:08 -08:00
David Fifield
af70d49e96 Add a log messages when failing to open a listener. 2017-01-20 17:56:52 -08:00
David Fifield
42cdd53077 continue, not break, after SmethodError.
This was a bug added in 8378f85952 when
this code was moved out of a switch.
2017-01-20 15:22:11 -08:00
David Fifield
8378f85952 Remove a level of indentation in server. 2017-01-20 10:19:25 -08:00
David Fifield
d8411816c4 Include "tls=no" or "tls=yes" in the bridge descriptor.
Might make this controlled by ServerTransportOptions instead of the
--disable-tls command line option.
2017-01-20 10:13:39 -08:00
David Fifield
aa204af6b1 Make log messages more uniform. 2017-01-20 09:43:33 -08:00
David Fifield
21e27d3b3c Use log.Fatalf instead of log.Printf + os.Exit in server. 2017-01-20 09:39:53 -08:00
David Fifield
11f3bbe3c2 go fmt in server. 2017-01-19 16:42:29 -08:00
David Fifield
15963688c2 Remove support for the base64 WebSocket subprotocol.
This was only needed for very very old Firefox before WebSockets were
properly standardized.
2017-01-18 20:00:59 -08:00
David Fifield
3e78251715 Remove the --port option from WebSocket server.
Recommend ServerTransportListenAddr in torrc instead.
2017-01-18 19:33:07 -08:00
David Fifield
2a9126a158 Simplify signal handling in WebSocket server.
pt-spec no longer talks about SIGINT.
2017-01-18 19:24:02 -08:00
David Fifield
57f72ab4ff Remove unused logFile variable. 2017-01-18 19:20:30 -08:00
Arlo Breault
3516599bae Fix lint complaints 2017-01-18 17:23:18 -08:00
Arlo Breault
61a2702ded Pass on exit code from spawned task so CI fails 2017-01-18 17:20:13 -08:00
Arlo Breault
815f976355 go get websocket in CI 2017-01-18 17:06:01 -08:00