Commit graph

132 commits

Author SHA1 Message Date
itchyonion
07b5f07452
Validate SDP offers and answers 2023-05-29 10:12:48 -07:00
Shelikhoo
36f03dfd44
Record proxy type for proxy relay stats 2022-09-23 13:08:13 +01:00
itchyonion
03b2b56f87 Fix broker race condition 2022-07-19 18:25:27 -07:00
Shelikhoo
2541b13166
Add distinct IP counter to broker 2022-06-16 15:00:10 +01:00
Shelikhoo
fa7d1e2bb7
Add distinct IP counter to metrics 2022-06-16 14:58:12 +01:00
Shelikhoo
a4bbb728e6
Fix not zero metrics for 1.3 values 2022-06-16 14:06:58 +01:00
Shelikhoo
8ba89179f1
Add document for LoadBridgeInfo input 2022-06-16 14:06:58 +01:00
Shelikhoo
8ab45651d0
Disallow unknown bridge list file field 2022-06-16 14:06:58 +01:00
Shelikhoo
f789dce6d2
Represent Bridge Fingerprint As String 2022-06-16 14:06:58 +01:00
Shelikhoo
dd61e2be0f
Add Proxy Relay URL Metrics Collection 2022-06-16 14:06:57 +01:00
Shelikhoo
b78eb74e42
Add Proxy Relay URL Rejection Metrics 2022-06-16 14:06:57 +01:00
Shelikhoo
7caab01785
Fixed desynchronized comment and behavior for log interval
In 64ce7dff1b, the log interval is modified while the comment is left unchanged.
2022-06-16 14:06:57 +01:00
Shelikhoo
b391d98679
Add Proxy Relay URL Support Counting Metrics Output 2022-06-16 14:06:57 +01:00
Shelikhoo
6e8fbe54ee
Rejection reason feedback 2022-06-16 14:06:57 +01:00
Shelikhoo
b18a9431b2
Add Broker Allowed Relay Pattern Indication Rejection for Proxy 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
02c6f764c9
Add support for specifying bridge list file 2022-06-16 14:06:56 +01:00
Shelikhoo
50c0d64e10
Add Detailed Error Output for proxyPolls, proxyAnswers 2022-06-16 14:06:56 +01:00
Shelikhoo
c7549d886e
Update default snowflake server address
Change snowflake broker test for updated address

Amend DefaultBridges Value

Add Default Fingerprint Info for Snowflake
2022-06-16 14:06:56 +01:00
Shelikhoo
5d7a3766d6
Add Relay Info Forwarding for Snowflake 2022-06-16 13:57:34 +01:00
Shelikhoo
5578b4dd76
Add Bridge List Holder Test 2022-06-16 13:57:00 +01:00
Shelikhoo
0822c5f87b
Add Bridge List Holder 2022-06-16 13:56:59 +01:00
Shelikhoo
3d4f294241
Add Bridge List Definition 2022-06-16 13:56:56 +01:00
Arlo Breault
2f89fbc2ed Represent fingerprint internally as byte array 2022-03-31 11:28:00 -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
Cecylia Bocovich
ead5a960d7
Bump snowflake library imports and go.mod to v2 2021-11-11 10:14:49 -05:00
meskio
4396d505a3
Use tpo geoip library
Now the geoip implmentation has being moved to it's own library to be
shared between projects.
2021-10-04 12:24:55 +02:00
David Fifield
e833119bef Broker /amp/client route (AMP cache client registration). 2021-08-05 16:13:24 -06:00
Cecylia Bocovich
c1b0fdd8cf Cleaned up and reorganized READMEs 2021-07-19 10:16:26 -04:00
Arlo Breault
2c2f93c022 Remove and restore some comments, after review 2021-07-08 15:35:04 -04:00
Arlo Breault
dfb68d7cfc Fix race is broker test reported by go test -race 2021-07-08 15:32:25 -04: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
0ced1cc324 Move http handlers to a separate file 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
meskio
7a1857c42f
Make the proxy to report the number of clients to the broker
So the assignment of proxies is based on the load. The number of clients
is ronded down to 8. Existing proxies that doesn't report the number
of clients will be distributed equaly to new proxies until they get 8
clients, that is okish as the existing proxies do have a maximum
capacity of 10.

Fixes #40048
2021-07-07 19:36:20 +02:00
Cecylia Bocovich
270eb21803 Encode client-broker messages as json in HTTP body
Send the client poll request and response in a json-encoded format in
the HTTP request body rather than sending the data in HTTP headers. This
will pave the way for using domain-fronting alternatives for the
Snowflake rendezvous.
2021-06-02 09:52:42 -04:00
Arlo Breault
7ef49272fa Remove sync.Once from around logMetrics
Follow up to 160ae2d

Analysis by @dcf,

> I don't think the sync.Once around logMetrics is necessary anymore.
Its original purpose was to inhibit logging on later file handles of
metrics.log, if there were more than one opened. See 171c55a9 and #29734
(comment 2593039) "Making a singleton *Metrics variable causes problems
with how Convey does tests. It shouldn't be called more than once, but
for now I'm using sync.Once on the logging at least so it's explicit."
Commit ba4fe1a7 changed it so that metrics.log is opened in main, used
to create a *log.Logger, and that same instance of *log.Logger is passed
to both NewMetrics and NewBrokerContext. It's safe to share the same
*log.Logger across multiple BrokerContext.
2021-05-20 15:39:30 -04:00
Arlo Breault
160ae2dd71 Make promMetrics not a global
Doesn't seem like it needs to exist outside of the metrics struct.

Also, the call to logMetrics is moved to the constructor.  A metrics
instance is only created when a BrokerContext is created, which only
happens at startup.  The sync of only doing that once is left for
documentation purposes, since it doesn't hurt, but also seems redundant.
2021-05-18 20:07:43 -04:00
Cecylia Bocovich
af6e2c30e1 Replace default with custom prometheus registry
The default prometheus registry exports data that may be useful for
side-channel attacks. This removes all of the default metrics and makes
sure we are only reporting snowflake metrics from the broker.
2021-04-26 14:18:50 -04:00
Cecylia Bocovich
2a310682b5 Add new gauge to show currently available proxies 2021-04-26 14:18:50 -04:00
Cecylia Bocovich
92bd900bc5 Implement binned counts for polling metrics 2021-04-26 14:07:55 -04:00
Cecylia Bocovich
83ef0b6f6d Export snowflake broker metrics for prometheus
This change adds a prometheus exporter for our existing snowflake broker
metrics. Current values for the metrics can be fetched by sending a GET
request to /prometheus.
2021-04-22 10:39:35 -04:00
Cecylia Bocovich
bae0bacbfd Classify proxies with unknown NATs as restricted 2021-01-25 14:05:24 -05:00
Philipp Winter
5efcde5187
Sort snowflake-ips stats by country count.
We currently don't sort the snowflake-ips metrics:

    snowflake-ips CA=1,DE=1,AR=1,NL=1,FR=1,GB=2,US=4,CH=1

To facilitate eyeballing our metrics, this patch sorts snowflake-ips by
value.  If the value is identical, we sort by string, i.e.:

    snowflake-ips US=4,GB=2,AR=1,CA=1,CH=1,DE=1,FR=1,NL=1

This patch fixes tpo/anti-censorship/pluggable-transports/snowflake#40011
2020-11-27 11:20:40 -08:00
Cecylia Bocovich
3c3317503e Update broker stats to include info on NAT types
As we now partition proxies by NAT type, our stats are more useful if they
capture how many proxies of each type we have, and information on
whether we have enough proxies of the right NAT type for our clients.
This change adds proxy counts by NAT type and binned counts of denied clients by NAT type.
2020-08-24 09:39:17 -04:00