mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Add UDP Like transport mode to snowflake
This commit is contained in:
parent
fa122efb61
commit
457c4fbf15
8 changed files with 275 additions and 5 deletions
|
@ -339,6 +339,16 @@ func newSession(snowflakes SnowflakeCollector) (net.PacketConn, *smux.Session, e
|
|||
return nil, errors.New("handler: Received invalid Snowflake")
|
||||
}
|
||||
log.Println("---- Handler: snowflake assigned ----")
|
||||
log.Printf("activeTransportMode = %c \n", conn.activeTransportMode)
|
||||
if conn.activeTransportMode == 'u' {
|
||||
packetIDConn := newPacketClientIDConn(clientID, conn)
|
||||
packetConnWrapper := &packetConnWrapper{
|
||||
ReadWriter: packetIDConn,
|
||||
remoteAddr: dummyAddr{},
|
||||
localAddr: dummyAddr{},
|
||||
}
|
||||
return packetConnWrapper, nil
|
||||
}
|
||||
// Send the magic Turbo Tunnel token.
|
||||
_, err := conn.Write(turbotunnel.Token[:])
|
||||
if err != nil {
|
||||
|
@ -363,7 +373,7 @@ func newSession(snowflakes SnowflakeCollector) (net.PacketConn, *smux.Session, e
|
|||
return nil, nil, err
|
||||
}
|
||||
// Permit coalescing the payloads of consecutive sends.
|
||||
conn.SetStreamMode(true)
|
||||
conn.SetStreamMode(false)
|
||||
// Set the maximum send and receive window sizes to a high number
|
||||
// Removes KCP bottlenecks: https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40026
|
||||
conn.SetWindowSize(WindowSize, WindowSize)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue