Commit graph

310 commits

Author SHA1 Message Date
David Fifield
55a06f216c Delete stray space. 2025-06-19 15:26:39 +00:00
Gus
506c33a2fd Update Snowflake bridge lines - CDN77, ampcache, and SQS 2025-05-12 20:03:54 +01:00
WofWca
4205121689 fix: make NATPolicy thread-safe
Although it does not look like that there are situations
where it is critical to use a mutex, because it's only used
when performing rendezvous with a proxy, which doesn't happen
too frequently,
let's still do it just to be sure.
2025-03-12 00:47:22 +04:00
WofWca
1923803124 fix: potential race conditions with non-local err
Some of the changes do not appear to have a potential race condition,
so there it is purely a refactor,
while in others (e.g. in broker.go and in proxy/lib/snowflake.go)
we do use the same variable from multiple threads / functions.
2025-03-12 00:47:07 +04:00
Cecylia Bocovich
eb13b2ff4b
Copy base client config for each SOCKS connection
Fixes a bug where socksAcceptLoop was reusing the same client config
when processing arguments from multiple SOCKS connections, causing
different bridge lines to clobber each other.
2025-02-25 10:40:51 -05:00
onyinyang
26f7ee4b06
Remove utls library from snowflake and Use ptuil/utls 2025-01-29 13:01:33 -05:00
David Fifield
1895bb9d2c Comment typo. 2025-01-13 08:49:15 +00:00
David Fifield
dbad475254 Finish incomplete comment for newEncapsulationPacketConn. 2024-12-12 06:40:57 +00:00
WofWca
94b6647d33
feat(client): try restricted proxy if NAT unknown
Just once, to offload unrestricted proxies.
This is useful when our STUN servers are blocked or don't support
the NAT discovery feature, or if they're just slow.

Closes https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40178.
Partially addresses https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40376

Signed-off-by: Cecylia Bocovich <cohosh@torproject.org>
2024-12-05 10:34:08 -05:00
WofWca
f6767061e4
refactor: separate some Negotiate logic
As per https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/merge_requests/392#note_3096760
in preparation for further changes to `Negotiate`.
2024-12-05 10:27:36 -05:00
Cecylia Bocovich
75e73ce397
Fixup new STUN servers to include protocol 2024-12-04 12:02:18 -05:00
Cecylia Bocovich
cc644134ad
Added new RFC 5780 compatible STUN servers 2024-12-03 15:36:12 -05:00
Cecylia Bocovich
1607f9ce85
Remove nonfunctional STUN servers
Remove STUN servers that are offline, appear to be misconfigured, or do
not support NAT discovery
2024-12-03 15:21:07 -05:00
WofWca
ae5bd52821
improvement: use SetIPFilter for local addrs
Closes https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40271.
Supersedes https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/merge_requests/417.

This simplifies the code and (probably) removes the need for
`StripLocalAddresses`, although makes us more dependent on Pion.

Signed-off-by: Cecylia Bocovich <cohosh@torproject.org>
2024-11-28 10:56:40 -05:00
Shelikhoo
239357509f
update snowflake to use pion webrtc v4 2024-11-13 14:58:53 +00:00
Renovate Bot
290be512e3 chore(deps): update module github.com/pion/webrtc/v3 to v4 2024-11-11 18:45:36 +00:00
Cecylia Bocovich
0d8bd159ec
Have SnowflakeConn.Close() return errors
Return an error if the connection was already closed. On the first
close, return an error if any of the calls inside Close() returned an
error in this order:
- smux.Stream.Close()
- pconn.Close()
- smux.Session.Close()
2024-10-29 14:58:01 -04:00
Cecylia Bocovich
a019fdaec9
Perform SnowflakeConn.Close() logic only once
Use synchronization to avoid a panic if SnowflakeConn.Close is called
more than once.
2024-10-29 14:58:01 -04:00
Neel Chauhan
8792771cdc
broker and proxy must not reject client offers with no ICE candidates
Fixes #40371. Partially reverts !141.
2024-10-17 15:46:02 -04:00
WofWca
9b04728809
docs: improve proxy CLI param descriptions
Since the proxy component is the most dedicated for public use,
more comprehensive docs are good.
2024-09-25 16:50:18 +01:00
WofWca
78f4b9dbc5 test(client): add test for BrokerChannel 2024-09-08 14:50:08 +04:00
David Fifield
bb2126b7c6
Use %w, not %v, in fmt.Errorf, so errors can be unwrapped.
https://go.dev/blog/go1.13-errors#wrapping-errors-with-w
2024-08-21 17:00:18 -04:00
meskio
6d2011ded7
Report a different implementation for client and server 2024-08-07 12:33:37 +02:00
David Fifield
ee5f815f60 Cosmetic changes from dev-snowflake-udp-rebase-extradata.
https://gitlab.torproject.org/shelikhoo/snowflake/-/tree/dev-snowflake-udp-rebase-extradata
commit 59b76dc68d2ee0383c2acd91cb0f44edc46af939
2024-08-01 22:12:56 +00:00
meskio
9e977fe6ca
Report the version of snowflake to the Tor process 2024-07-11 13:39:56 +02:00
meskio
a9df5dd71a
Use ptutil for safelog and prometheus rounded metrics
* Related: #40354
2024-05-09 16:24:33 +02:00
Cecylia Bocovich
96422e0db3
Update torrc file to match Tor Browser builtins
We switched to a CDN77, a cloud provider that supports domain fronting.
2024-03-24 12:41:23 -04:00
Michael Pu
9fe2ca58a0 Switch to sqscreds param for passing in SQS credentials 2024-03-09 13:35:16 -05:00
Michael Pu
1e1f827248
Update tests 2024-03-05 12:38:33 -05:00
Michael Pu
9cd362f42d
Move SQS client ID generation to Exchange 2024-03-05 12:38:33 -05:00
am3o
acce1f1fd9
refactor: change deprecated "io/ioutil" package to recommended "io" package 2024-02-17 12:47:22 +01:00
Andrew Wang
9b90b77d69
Add unit tests for SQS rendezvous in broker
Co-authored-by: Michael Pu <michael.pu@uwaterloo.ca>
2024-01-22 13:11:03 -05:00
Anthony Chang
32e864b71d
Add unit tests for SQS rendezvous in client
Co-authored-by: Michael Pu <michael.pu@uwaterloo.ca>
2024-01-22 13:11:03 -05:00
Anthony Chang
f3b062ddb2
Add mocks and interfaces for testing SQS rendezvous
Co-authored-by: Michael Pu <michael.pu@uwaterloo.ca>
2024-01-22 13:10:56 -05:00
Michael Pu
8fb17de152
Implement SQS rendezvous in client and broker
This features adds an additional rendezvous method to send client offers
and receive proxy answers through the use of Amazon SQS queues.

https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/26151
2024-01-22 13:06:42 -05:00
David Fifield
d0529141ac Cosmetic fixes taken from !219.
shelikhoo/dev-udp-performance-rebased branch
https://gitlab.torproject.org/shelikhoo/snowflake/-/commits/9dce28cfc2093490473432ffecd9abaab7ebdbdb
2024-01-16 18:43:58 +00:00
Arlo Breault
98db63ad01 Update recommended torrc options in the client readme
For #40294
2024-01-04 17:36:22 +00:00
David Fifield
aa06e7bef3 Merge branch 'encapsulation-readdata-buffer' 2023-11-21 03:46:46 +00:00
David Fifield
234d9cb11c Link a section in the pion/webrtc@3.0.0 release notes. 2023-11-21 01:27:09 +00:00
David Fifield
d99f31d881 Have encapsulation.ReadData return an error when the buffer is short.
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/merge_requests/154#note_2919109

Still ignoring the io.ErrShortBuffer at the callers, which retains
current behavior.
2023-11-07 05:51:35 +00:00
David Fifield
001f691b47 Have encapsulation.ReadData read into a provided buffer.
Instead of unconditionally allocating its own.
2023-11-07 05:51:35 +00:00
Cecylia Bocovich
10fb9afaa7
Check if multiple front domains argument is empty
This fixes a regression introduced in 9fdfb3d1, where the list of front
domains always contained an empty string if none were supplied via the
commandline options, causing rendezvous failures for both amp cache and
domain fronting. This fix checks to see whether the commandline option
was supplied.
2023-10-26 17:04:56 -04:00
Shelikhoo
5df7a06eee
Add outbound proxy configuration propagation 2023-10-24 17:47:25 +01:00
Cecylia Bocovich
d434549df8
Maintain backward compatability with old clients
Introduce a new commandline and SOCKS argument for comma-separated
domain fronts rather than repurposing the old one so that we can
maintain backwards compatability with users running old versions of the
client. A new bridge line shared on circumvention settings could have
both the front= and fronts= options set.
2023-10-05 17:51:56 -04:00
Cecylia Bocovich
9fdfb3d1b5
Randomly select front domain from comma-separated list
This commmit changes the command-line and Bridge line arguments to take
a comma-separated list of front domains. The change is backwards
compatible with old Bridge and ClientTransportPlugin lines. At
rendezvous time, a front domain will be randomly chosen from the list.
2023-10-05 17:51:56 -04:00
Cecylia Bocovich
b632c7d49c
Workaround for shadow in lieu of AF_NETLINK support
For details, see https://github.com/shadow/shadow/issues/2980
2023-08-24 16:33:22 +01:00
Cecylia Bocovich
f8eb86f24d
Append Let's Encrypt ISRG Root X1 to cert pool
This is a workaround for older versions of android that do not trust
the Let's Encrypt root certificate.
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40087
2023-06-14 18:12:29 -04:00
meskio
82cc0f38f7
Move the development to gitlab
Related: tpo/anti-censorship/team#86
2023-05-31 10:01:47 +02:00
itchyonion
07b5f07452
Validate SDP offers and answers 2023-05-29 10:12:48 -07:00
meskio
297ca91b1d
Use goptlib from gitlab.torproject.org 2023-04-19 17:15:35 +02:00