Commit graph

1505 commits

Author SHA1 Message Date
Renovate Bot
3a38526aa1
Update module golang.org/x/sys to v0.35.0 2025-08-20 09:59:14 -04:00
Renovate Bot
06c6fd0683 Update module golang.org/x/net to v0.38.0 [SECURITY] 2025-08-20 13:41:27 +00:00
Cecylia Bocovich
2740e1bbf9
Bump minimum supported go version to 1.23.0 2025-08-20 09:35:32 -04:00
Cecylia Bocovich
c8b0b31601
Clear map of seen proxy IP addresses
We were not previously clearing the map we keep of seen IP addresses,
which resulted in our unique proxy IP counts representing churn rather
than unique IP counts per day, except during broker process restarts.
2025-08-20 09:35:32 -04:00
Cecylia Bocovich
43a35655ad
Add failing test for cleared IP map
We are not clearing the map of seen IP addresses when metrics are
printed, resulting in lower than expected unique IP address counts for
daily metrics.

See https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40472
2025-08-20 09:35:32 -04:00
Shelikhoo
14b8cde3da
Update probetest container images to build binary and reduce final image size with multiple stages 2025-08-20 11:44:35 +01:00
Shelikhoo
ca07f57448
Remove s390x from container building targets 2025-08-19 21:10:14 +01:00
Cecylia Bocovich
f4027c1128
Use Go 1.24 for android CI job
gomobile now requres go >= 1.24.0
2025-08-19 13:08:48 -04:00
David Fifield
fd42bcea8a Comment typo. 2025-08-19 14:50:23 +00:00
David Fifield
74c39cc8e9
Bin country stats counts before sorting, not after.
This avoids an information leak where, if two countries have the same
count but are not in alphabetical order, you know the first one had a
larger count than the second one before binning.

Example: AA=25,BB=27

Without binning, these should sort descending by count:
BB=27,AA=25

But with binning, the counts are the same, so it should sort ascending
by country code:
AA=32,BB=32

Before this change, BB would sort before AA even after binning, which
lets you infer that the count of BB was greater than the count of AA
*before* binning:
BB=32,AA=32
2025-08-19 09:58:51 -04:00
David Fifield
7a003c9bb1
Add a failing test for ordering of country stats that bin to the same value. 2025-08-19 09:58:50 -04:00
David Fifield
9946c0f1d8
Add a test for formatAndClearCountryStats with binned=true. 2025-08-19 09:58:50 -04:00
David Fifield
bd04cd7752
Refactor TestFormatAndClearCountryStats. 2025-08-19 09:58:50 -04:00
David Fifield
cc0a33faea
Move formatAndClearCountryStats test into a new metrics_test.go.
This is more unit test–y. We don't need a full broker instantiation for
testing this function, unlike other tests in snowflake-broker_test.go.
2025-08-19 09:58:50 -04:00
David Fifield
ec39237e69 Add a test that formatAndClearCountryStats clears the map. 2025-08-15 19:24:58 +00:00
David Fifield
ed3bd99df6 Rename displayCountryStats to formatAndClearCountryStats.
The old name did not make it clear that the function has the side effect
of clearing the map.
2025-08-15 19:24:58 +00:00
David Fifield
75daf2210f Refactor displayCountryStats.
Move the record types closer to where they are used.

Use a strings.Builder rather than repeatedly concatenating strings
(which creates garbage).

Use the value that m.Range already provides us, don't look it up again
with LoadAndDelete.

Add documentation comments.
2025-08-15 19:24:58 +00:00
David Fifield
6e0e5f9137 Express records.Less more clearly. 2025-08-15 19:24:58 +00:00
David Fifield
fed11184c7 Have records.Less express the order we want directly.
The ordering is descending by count, then ascending by cc. Express that
directly, rather than specifying the opposite ordering and using
sort.Reverse.
2025-08-15 19:24:58 +00:00
David Fifield
b058b10a94 Express binCount using integer operations.
No need to bring a float64 into this.
2025-08-15 19:24:58 +00:00
Cecylia Bocovich
70974640ab
Defer SQS client IP extraction to ClientOffers
Now that both SQS and AMP cache are pulling remote addresses from the
SDP, avoid duplicate decodings of the ClientPollRequest by extracting
the remote addr in ClientOffers.
2025-08-14 14:13:47 -04:00
Cecylia Bocovich
0bbcb1eca4
Add test for AMP cache geolocation 2025-08-14 14:13:47 -04:00
Cecylia Bocovich
31f879aad5
Pull client IP from SDP for AMP cache rendezvous
The remote address for AMP cache rendezvous is always geolocated to the
AMP cache server address. For more accurate metrics on where this
rendezvous method is used and working, we can pull the remote address
directly from the client SDP sent in the poll request.
2025-08-14 14:13:47 -04:00
Shelikhoo
8ae1994e4b
Update snowflake proxy image to use most recent golang and geodb 2025-07-31 15:01:07 +01:00
meskio
a9fe899198
Merge remote-tracking branch 'gitlab/mr/593' 2025-07-31 11:19:18 +02:00
Renovate Bot
437cc37443 chore(deps): update module github.com/aws/aws-sdk-go-v2/config to v1.30.2 2025-07-30 19:29:12 +00:00
Renovate Bot
a176e7567d
chore(deps): update module github.com/aws/aws-sdk-go-v2/config to v1.29.18 2025-07-22 10:00:58 -04:00
Renovate Bot
79c4dfbdc8
chore(deps): update module github.com/pion/sdp/v3 to v3.0.15 2025-07-22 09:58:16 -04:00
Cecylia Bocovich
58b1d48e54
Increment prometheus proxy_total count once per IP
This fixes a regression from !574 that did not check whether the IP was
unique before incrementing the counter.

Closes https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40470
2025-07-10 10:41:26 -04:00
Cecylia Bocovich
d7ebb2f99c
Add clarification to broker-spec on client-*-ips 2025-07-10 10:34:26 -04:00
David Auer
1dc9947d2a Fix missing labels in Docker image
In a multi stage Docker build, the LABEL commands need to be applied in the final stage.
2025-07-08 20:58:09 +00:00
Cecylia Bocovich
1d73e14f34
Rename metrics update functions
This changes the metrics update functions to UpdateProxyStats and
UpdateClientStats, which is more accurate and clear than the previous
CountryStats and RendezvousStats names.
2025-06-24 13:12:10 -04:00
Cecylia Bocovich
78cf8e68b2
Simplify broker metrics and remove mutexes
This is a large change to how the snowflake broker metrics are
implemented. This change removes all uses of mutexes from the metrics
implementation in favor of atomic operations on counters stored in
sync.Map.

There is a small change to the actual metrics output. We used to count
the same proxy ip multiple times in our snowflake-ips-total and
snowflake-ips country stats if the same proxy ip address polled more
than once with different proxy types. This was an overcounting of the
number of unique proxy IP addresses that is now fixed.

If a unique proxy ip polls with more than one proxy type or nat type,
these polls will still be counted once for each proxy type or nat type
in our proxy type and nat type specific stats (e.g.,
snowflake-ips-nat-restricted and snowflake-ips-nat-unrestricted).
2025-06-24 13:12:10 -04:00
David Fifield
64c7a26475 Comment typo. 2025-06-19 15:39:24 +00:00
David Fifield
55a06f216c Delete stray space. 2025-06-19 15:26:39 +00:00
Renovate Bot
2650ef7468
chore(deps): update module github.com/pion/webrtc/v4 to v4.1.2 2025-06-18 15:56:40 +01:00
Renovate Bot
647d5d37c7
chore(deps): update module github.com/pion/sdp/v3 to v3.0.12 2025-05-21 10:55:22 -04:00
Cecylia Bocovich
a377a4e0da
Add client-snowflake-timeout-count to broker spec
We added a new snowflake metric on the number of timeouts. This brings
doc/broker-spec.txt up to date on our current exported metrics.
2025-05-20 12:29:41 -04:00
meskio
1c53a63744
Merge remote-tracking branch 'gitlab/mr/569' 2025-05-13 13:43:15 +02:00
Gus
506c33a2fd Update Snowflake bridge lines - CDN77, ampcache, and SQS 2025-05-12 20:03:54 +01:00
Renovate Bot
5d956456a5
chore(deps): update module github.com/prometheus/client_golang to v1.22.0 2025-05-01 14:24:46 +01:00
Renovate Bot
e5a8a16efc
chore(deps): update module github.com/aws/aws-sdk-go-v2/config to v1.29.14 2025-05-01 13:42:30 +01:00
meskio
726d66c75c
Merge remote-tracking branches 'gitlab/mr/551', 'gitlab/mr/552' and 'gitlab/mr/555' 2025-04-29 10:26:40 +02:00
Renovate Bot
8fa0717552 chore(deps): update module github.com/pion/webrtc/v4 to v4.1.0 2025-04-28 12:40:55 +00:00
Renovate Bot
28fd1ecc2b chore(deps): update module github.com/aws/aws-sdk-go-v2/service/sqs to v1.38.5 2025-04-28 12:40:51 +00:00
Renovate Bot
236f15f81c chore(deps): update module github.com/aws/aws-sdk-go-v2/credentials to v1.17.67 2025-04-28 12:40:45 +00:00
Shelikhoo
a4a55e4398
CI: fix invalid group name by removing trail slash 2025-04-28 13:25:53 +01:00
Renovate Bot
ef276c8161
chore(deps): update module github.com/pion/ice/v4 to v4.0.10 2025-04-24 14:59:22 +01:00
Shelikhoo
3d7dcfc55d
Add updated docker compose file 2025-04-17 16:41:22 +01:00
meskio
2a5a09e451
CI: use the parent group as namespace for the dependency proxy
This should solve our problem failing to get images on CI runs.
2025-04-16 15:41:36 +02:00