David Fifield
3df514ae29
Call WriteMessage directly in websocketconn.Conn.Write.
...
In the client←server direction, this hits a fast path that avoids
allocating a messageWriter.
https://github.com/gorilla/websocket/blob/v1.5.0/conn.go#L760
Cuts the number of allocations in half in the client←server direction:
$ go test -bench=BenchmarkReadWrite -benchmem -benchtime=5s
BenchmarkReadWrite/c←s_150-4 597511 13358 ns/op 11.23 MB/s 33709 B/op 2 allocs/op
BenchmarkReadWrite/s←c_150-4 474176 13756 ns/op 10.90 MB/s 34968 B/op 4 allocs/op
BenchmarkReadWrite/c←s_3000-4 156488 36290 ns/op 82.67 MB/s 68673 B/op 5 allocs/op
BenchmarkReadWrite/s←c_3000-4 190897 34719 ns/op 86.41 MB/s 69730 B/op 8 allocs/op
2022-11-16 13:48:34 -07:00
David Fifield
8cadcaee70
Benchmark for websocketconn.Conn read/write.
...
Current output:
$ go test -bench=BenchmarkReadWrite -benchmem -benchtime=5s
BenchmarkReadWrite/c←s_150-4 451840 13904 ns/op 10.79 MB/s 34954 B/op 4 allocs/op
BenchmarkReadWrite/s←c_150-4 452560 16134 ns/op 9.30 MB/s 36378 B/op 4 allocs/op
BenchmarkReadWrite/c←s_3000-4 202950 40846 ns/op 73.45 MB/s 69833 B/op 8 allocs/op
BenchmarkReadWrite/s←c_3000-4 189262 37930 ns/op 79.09 MB/s 69768 B/op 8 allocs/op
2022-11-16 13:48:34 -07:00
itchyonion
768b80dbdf
Use event logger for proxy starting message and NAT info
2022-11-16 10:08:10 -08:00
trinity-1686a
5ef5142bb0
format using go-1.19
2022-10-09 21:15:50 +02:00
Shelikhoo
35e9ab8c0b
Use truncated hash instead crc64 for counted hash
2022-06-16 15:00:12 +01:00
Shelikhoo
b18e6fcfe4
Add document for Distinct IP file
2022-06-16 15:00:12 +01:00
Shelikhoo
211254fa98
Add distinct IP counter
2022-06-16 14:58:12 +01:00
Shelikhoo
97dea533da
Update Relay Pattern format to include dollar sign
2022-06-16 14:06:58 +01:00
Shelikhoo
e5b799d618
Update documents for broker messages
2022-06-16 14:06:58 +01:00
Shelikhoo
0ae4d821f0
Move ErrExtraInfo to ipc.go
2022-06-16 14:06:58 +01:00
Shelikhoo
c5e5b45b06
Update message protocol version to 1.3 for RelayURL
2022-06-16 14:06:58 +01:00
Shelikhoo
f789dce6d2
Represent Bridge Fingerprint As String
2022-06-16 14:06:58 +01:00
Shelikhoo
1b48ee14f4
Add test for proxy poll with Relay URL
2022-06-16 14:06:57 +01:00
Shelikhoo
6e8fbe54ee
Rejection reason feedback
2022-06-16 14:06:57 +01:00
Shelikhoo
2ebdc89c42
Add Allowed Relay Hostname Pattern Indication
2022-06-16 14:06:57 +01:00
Shelikhoo
613ceaf970
Add RelayURL and AllowedRelayPattern to snowflake signaling
2022-06-16 13:57:33 +01:00
Shelikhoo
38f0e00e5d
Add Domain Name Matcher
...
Design difference from original vision: Skipped FQDN step to make it more generalized
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/28651#note_2787394
2022-06-16 13:57:33 +01:00
meskio
f38c91f906
Don't use entropy for test
...
Use math/rand instead of crypto/rand, so entropy is not a blocker when
running the tests.
2022-06-02 17:24:54 +02:00
itchyonion
e4c01f0595
Wrap client NAT log
2022-05-31 08:52:23 -07:00
meskio
1d592b06e5
Implement String() method on events
...
To make it safe for logging safelog.Scrub function is now public.
Closes : #40141
2022-05-25 18:09:06 +02:00
itchyonion
9757784c5a
Wait some time before displaying the proxy usage log
2022-05-25 11:01:01 -04:00
Arlo Breault
2f89fbc2ed
Represent fingerprint internally as byte array
2022-03-31 11:28:00 -04:00
Arlo Breault
fa2f6824d9
Add some test cases for client poll requests
2022-03-21 15:31:02 -04:00
Arlo Breault
b563141c6a
Forward bridge fingerprint
...
gitlab 28651
2022-03-21 15:06:05 -04:00
Arlo Breault
281d917beb
Stop storing version in ClientPollRequest
...
This continues to asserts the known version while decoding. The client
will only ever generate the latest version while encoding and if the
response needs to change, the impetus will be a new feature, set in the
deserialized request, which can be used as a distinguisher.
2022-03-21 15:06:05 -04:00
meskio
b265bd3092
Make easier to extend the list of known proxy types
...
And include iptproxy as a valid proxy type.
2022-03-21 19:23:49 +01:00
Arlo Breault
829cacac5f
Parse ClientPollRequest version in DecodeClientPollRequest
...
Instead of IPC.ClientOffers. This makes things consistent with
EncodeClientPollRequest which adds the version while serializing.
2022-03-16 15:43:10 -04:00
Arlo Breault
6fd0f1ae5d
Rename *PollRequest methods to distinguish client/proxy
2022-03-16 15:43:10 -04:00
Shelikhoo
6e29dc676c
Add document for NewUTLSHTTPRoundTripper
2022-03-16 09:13:30 +00:00
Shelikhoo
3132f68012
Add connection expire time for uTLS pendingConn
2022-03-16 09:13:29 +00:00
Shelikhoo
8d5998b744
Harmonize identifiers to uTLS
2022-03-16 09:13:29 +00:00
Shelikhoo
f525490032
Update utls test to match uTLS Round Tripper constructor
2022-03-16 09:13:29 +00:00
Max Bittman
c1c3596cf8
Add name to utls client hello id
2022-03-16 09:13:28 +00:00
Shelikhoo
c1b0f763ef
Add reformat for utls roundtripper
2022-03-16 09:13:28 +00:00
Shelikhoo
4447860661
Add repeated test for utls roundtripper
2022-03-16 09:13:28 +00:00
Shelikhoo
006abdead4
Add utls roundtripper
2022-03-16 09:13:25 +00:00
Shelikhoo
d64af31394
Add EventOnProxyConnectionOver Event
2022-01-25 13:03:18 +00:00
Shelikhoo
b5ef18803f
Add Event Bus Test
2022-01-25 12:49:57 +00:00
Shelikhoo
5f03f88d73
Add Event Bus Implementation
...
This event bus implementation favours simplicity over efficiency and is not suitable for frequent addition and removal of listeners.
2022-01-25 12:49:56 +00:00
Shelikhoo
75f770150d
Add Snowflake Event API interface
2022-01-25 12:49:51 +00:00
Cecylia Bocovich
b35a79ac24
Validate client and proxy supplied strings
...
Malicious clients and proxies can provide potentially malicious strings
in the polls. This validates the NAT type and proxy type strings to
ensure that malformed strings are not displayed on a web page
or passed to any of our monitoring infrastructure.
If a client or proxy supplies an invalid NAT type, we return an error
message. If a proxy supplies an unknown proxy type, we set the proxy
type to unknown.
2022-01-12 11:30:41 -05:00
Shelikhoo
40f44d6272
Add V2Ray/V2Fly License for task
2021-11-19 15:55:30 +00:00
Shelikhoo
d4fdb35ee8
Add in source indicator of file origin
...
Adopted the change in according to the recommendation from
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/merge_requests/62#note_2759815
2021-11-12 10:56:57 +00:00
Shelikhoo
4c8a166178
Port V2Ray periodic task standard library to snowflake
...
This is a mature implementation of periodic task that run a function at given interval. It allows task to be stopped, and deals with edge case like interval too short gracefully.
V2Ray/V2Fly is MIT licensed.
2021-11-12 10:48:14 +00:00
Cecylia Bocovich
ead5a960d7
Bump snowflake library imports and go.mod to v2
2021-11-11 10:14:49 -05:00
Cecylia Bocovich
e6715cb4ee
Increase smux and QueuePacketConn buffer sizes
...
This should increase the maximum amount of inflight data and hopefully
the performance of Snowflake, especially for clients geographically
distant from proxies and the server.
2021-08-10 15:38:11 -04:00
David Fifield
c9e0dd287f
amp package.
...
This package contains a CacheURL function that modifies a URL to be
accessed through an AMP cache, and the "AMP armor" data encoding scheme
for encoding data into the AMP subset of HTML.
2021-08-05 16:13:24 -06:00
Arlo Breault
c3c84fdb48
Use variables for string matching
...
The legacy code does case matching on these exact strings so it's better
to ensure they're constant.
2021-07-08 12:47:23 -04:00
Arlo Breault
87ad06a5e2
Get rid of legacy version
...
Move the logic for the legacy version into the http handlers and use a
shim when doing ipc.
2021-07-08 12:32:37 -04:00
Arlo Breault
015958fbe6
Intermediary refactor teasing apart http / ipc
...
Introduces an IPC struct and moves the logic out of the http handlers
and into methods on that.
2021-07-08 12:32:35 -04:00