aboutsummaryrefslogtreecommitdiff
path: root/server
AgeCommit message (Collapse)Author
2024-05-09Use ptutil for safelog and prometheus rounded metricsmeskio
* Related: #40354
2024-03-22Comment typo.David Fifield
2024-02-17refactor: change deprecated "io/ioutil" package to recommended "io" packageam3o
2024-01-16Cosmetic fixes taken from !219.David Fifield
shelikhoo/dev-udp-performance-rebased branch https://gitlab.torproject.org/shelikhoo/snowflake/-/commits/9dce28cfc2093490473432ffecd9abaab7ebdbdb
2023-11-07Have encapsulation.ReadData return an error when the buffer is short.David Fifield
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-07Have encapsulation.ReadData read into a provided buffer.David Fifield
Instead of unconditionally allocating its own.
2023-06-08Use IP_BIND_ADDRESS_NO_PORT when dialing the ORPort on Linux.David Fifield
When the orport-srcaddr option is set, we bind to a source IP address before dialing the ORPort/ExtORPort. tor similarly binds to a source IP address when OutboundBindAddress is set in torrc. Since tor 0.4.7.13, tor sets IP_BIND_ADDRESS_NO_PORT, and because problems arise when some programs use IP_BIND_ADDRESS_NO_PORT and some do not, we also have to start using IP_BIND_ADDRESS_NO_PORT when we upgrade tor (tpo/anti-censorship/pluggable-transports/snowflake#40270). Related: tpo/anti-censorship/pluggable-transports/snowflake#40198
2023-05-31Move the development to gitlabmeskio
Related: tpo/anti-censorship/team#86
2023-04-20Merge remote-tracking branch 'gitlab/main'meskio
2023-04-19Use goptlib from gitlab.torproject.orgmeskio
2023-04-04Use a sync.Pool to reuse packet buffers in QueuePacketConn.David Fifield
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-03Restore ListenAndServe error return in Transport.Listen.David Fifield
This error return was lost in 11f0846264d4033e7a7dc7824febb6ad7140762f; i.e. !31. Fixes #40043.
2023-03-29Comment typo.David Fifield
2022-12-14Add a num-turbotunnel server transport option.David Fifield
Replaces the hardcoded numKCPInstances.
2022-12-14Use multiple parallel KCP state machines in the server.David Fifield
To distribute CPU load. https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40200
2022-12-13Fix server flag nameitchyonion
2022-12-08Have SnowflakeClientConn implement io.WriterTo.David Fifield
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-03Increase clientIDAddrMapCapacity to 98304.David Fifield
Recent increases in usage have exhausted the capacity of the map. https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40173
2022-11-23add version output to logShelikhoo
2022-11-23Add Version Output Support to SnowflakeShelikhoo
From now on, there will be a file at common/version/version.go that includes current version number.
2022-11-16Add a `orport-srcaddr` server transport option.David Fifield
The option controls what source address to use when dialing the (Ext)ORPort. Using a source address other than 127.0.0.1, or a range of addresses, can help with localhost ephemeral port exhaustion. https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40198
2022-11-16Reduce the smux KeepAliveTimeout on the server from 10 to 4 minutes.David Fifield
To save memory, we want to more aggressively close stale connections. https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40175
2022-10-09format using go-1.19trinity-1686a
2022-02-08Initialize SnowflakeListener.closedCecylia Bocovich
Fixes a bug where an uninitialized channel causes a panic when closed (#40099).
2022-02-07Remove support for oneshot modeCecylia Bocovich
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-01-18increase clientIDAddrMapCapacityShelikhoo
See also: https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40084
2022-01-18Suppress connection end log outputShelikhoo
This is an amendment of https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/merge_requests/30
2021-11-11Bump snowflake library imports and go.mod to v2v2.0.1Cecylia Bocovich
2021-10-07Change package name and add a package commentCecylia Bocovich
2021-10-07Add documentation where necessary for exported itemsCecylia Bocovich
2021-10-07Stop exporting internal codeCecylia Bocovich
2021-08-10Increase smux and QueuePacketConn buffer sizesCecylia Bocovich
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-07-19Cleaned up and reorganized READMEsCecylia Bocovich
2021-06-24Fix leak in server acceptLoopCecylia Bocovich
Refactor out a separate handleStream function and ensure that all connections are closed and the references are out of scope.
2021-06-19Store net.Addr in clientIDAddrMapCecylia Bocovich
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-05-12Ensure turbotunnel read and write loop terminateCecylia Bocovich
Introduce a waitgroup and done channel to ensure that both the read and write gorouting for turbotunnel connections terminate when the connection is closed.
2021-05-12Implement server as a v2.1 PT Go APICecylia Bocovich
2021-03-18Don't log errors from callng close on OR connsCecylia Bocovich
Snowflake copies data between the OR connection and the KCP stream, meaning that in most cases the copy loops will only terminate once the OR connection times out. In this case the OR connection is already closed and so calls to CloseRead and CloseWrite will generate errors.
2021-03-18Don't log io.ErrClosedPipe in serverCecylia Bocovich
These errors are triggered in three places when the OR connection times out. They don't tell us anything useful and are filling up our logs.
2020-12-17Increase the KCP maximum window sizeCecylia Bocovich
2020-04-23USERADDR support for turbotunnel sessions.David Fifield
The difficulty here is that the whole point of turbotunnel sessions is that they are not necessarily tied to a single WebSocket connection, nor even a single client IP address. We use a heuristic: whenever a WebSocket connection starts that has a new ClientID, we store a mapping from that ClientID to the IP address attached to the WebSocket connection in a lookup table. Later, when enough packets have arrived to establish a turbotunnel session, we recover the ClientID associated with the session (which kcp-go has stored in the RemoteAddr field), and look it up in the table to get an IP address. We introduce a new data type, clientIDMap, to store the clientID-to-IP mapping during the short time between when a WebSocket connection starts and handleSession receives a fully fledged KCP session.
2020-04-23Turbo Tunnel client and server.David Fifield
The client opts into turbotunnel mode by sending a magic token at the beginning of each WebSocket connection (before sending even the ClientID). The token is just a random byte string I generated. The server peeks at the token and, if it matches, uses turbotunnel mode. Otherwise, it unreads the token and continues in the old one-session-per-WebSocket mode.
2020-03-25Add unsafe loggingArlo Breault
2020-02-22In server, treat a client IP address of 0.0.0.0 as missing.David Fifield
Some proxies currently send ?client_ip=0.0.0.0 because of an error in how they attempt to grep the address from the client's SDP. That's inflating our "%d/%d connections had client_ip" logs. Instead, treat these cases as if the IP address were absent. https://bugs.torproject.org/33157 https://bugs.torproject.org/33385
2020-02-04Simplify a conditional.David Fifield
2020-01-31Remove unused maxMessageSize constant.David Fifield
2020-01-30Have websocketconn.New return a pointer.David Fifield
This makes the return type satisfy the io.ReadWriteCloser interface directly.
2020-01-30Remove some redundancy in websocketconn naming.David Fifield
Rename websocketconn.WebSocketConn to websocketconn.Conn, and websocketconn.NewWebSocketConn to websocketconn.New Following the guidelines at https://blog.golang.org/package-names#TOC_3%2e
2020-01-30Initialize the global upgrader.CheckOrigin statically.David Fifield
Only once, not again on every call to initServer.
2020-01-30Also show message in the "error copying WebSocket to ORPort" case.David Fifield
This was the only case out of the three not to show it.