Commit graph

17 commits

Author SHA1 Message Date
David Fifield
c097d5f3bc Use a sync.Pool to reuse packet buffers in QueuePacketConn.
This is meant to reduce overall allocations. See past discussion at
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40260#note_2885524 ff.
2023-04-04 20:22:32 -06:00
David Fifield
6bdd48c006 Restore ListenAndServe error return in Transport.Listen.
This error return was lost in 11f0846264;
i.e. !31.

Fixes #40043.
2023-04-03 00:18:26 -06:00
David Fifield
936a1f8138 Add a num-turbotunnel server transport option.
Replaces the hardcoded numKCPInstances.
2022-12-14 23:02:26 -07:00
David Fifield
c6fabb212d Use multiple parallel KCP state machines in the server.
To distribute CPU load.

https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40200
2022-12-14 23:02:26 -07:00
David Fifield
77b186ae6e Have SnowflakeClientConn implement io.WriterTo.
By forwarding the method to the inner smux.Stream. This is to prevent
io.Copy in the top-level proxy function from allocating a buffer per
client.

The smux.Stream WriteTo method returns io.EOF on success, contrary to
the contract of io.Copy that says it should return nil. Ignore io.EOF in
the proxy loop to avoid a log message.

/anti-censorship/pluggable-transports/snowflake/-/issues/40177
2022-12-08 08:03:54 -07:00
David Fifield
2f55581098
Reduce the smux KeepAliveTimeout on the server from 10 to 4 minutes.
To save memory, we want to more aggressively close stale connections.

https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40175
2022-11-16 18:48:14 +01:00
trinity-1686a
5ef5142bb0 format using go-1.19 2022-10-09 21:15:50 +02:00
Cecylia Bocovich
bcc162898a
Initialize SnowflakeListener.closed
Fixes a bug where an uninitialized channel causes a panic when closed
(#40099).
2022-02-08 13:00:43 -05:00
Cecylia Bocovich
c0b35076c9
Remove support for oneshot mode
Due to a bug (#40098), legacy oneshot connections have not worked for
awhile. Connections without the turbotunnel token would cause the server
to crash. This fixes that bug by removing support altogether and simply
closes the connection.
2022-02-07 11:39:23 -05:00
Shelikhoo
50646698e3
Suppress connection end log output
This is an amendment of https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/merge_requests/30
2022-01-18 14:33:27 -05:00
Cecylia Bocovich
ead5a960d7
Bump snowflake library imports and go.mod to v2 2021-11-11 10:14:49 -05:00
Cecylia Bocovich
04ba50a531 Change package name and add a package comment 2021-10-07 11:01:33 -04:00
Cecylia Bocovich
4623c7d3e1 Add documentation where necessary for exported items 2021-10-07 11:01:33 -04:00
Cecylia Bocovich
5339ed2dd7 Stop exporting internal code 2021-10-07 11:01:33 -04: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
Cecylia Bocovich
6634f2bec9 Store net.Addr in clientIDAddrMap
This fixes a stats collection bug where we were converting client
addresses between a string and net.Addr using the clientAddr function
multiple times, resulting in an empty string for all addresses.
2021-06-19 11:16:38 -04:00
Cecylia Bocovich
11f0846264 Implement server as a v2.1 PT Go API 2021-05-12 09:08:41 -04:00