mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Cosmetic changes from dev-snowflake-udp-rebase-extradata.
https://gitlab.torproject.org/shelikhoo/snowflake/-/tree/dev-snowflake-udp-rebase-extradata commit 59b76dc68d2ee0383c2acd91cb0f44edc46af939
This commit is contained in:
parent
a93b4859c7
commit
ee5f815f60
4 changed files with 11 additions and 9 deletions
|
@ -7,15 +7,15 @@ import (
|
|||
"crypto/tls"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/url"
|
||||
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/pion/webrtc/v3"
|
||||
utls "github.com/refraction-networking/utls"
|
||||
|
||||
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/certs"
|
||||
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/event"
|
||||
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/messages"
|
||||
|
@ -125,7 +125,8 @@ func newBrokerChannelFromConfig(config ClientConfig) (*BrokerChannel, error) {
|
|||
// Negotiate uses a RendezvousMethod to send the client's WebRTC SDP offer
|
||||
// and receive a snowflake proxy WebRTC SDP answer in return.
|
||||
func (bc *BrokerChannel) Negotiate(offer *webrtc.SessionDescription) (
|
||||
*webrtc.SessionDescription, error) {
|
||||
*webrtc.SessionDescription, error,
|
||||
) {
|
||||
// Ideally, we could specify an `RTCIceTransportPolicy` that would handle
|
||||
// this for us. However, "public" was removed from the draft spec.
|
||||
// See https://developer.mozilla.org/en-US/docs/Web/API/RTCConfiguration#RTCIceTransportPolicy_enum
|
||||
|
@ -201,7 +202,8 @@ func NewWebRTCDialerWithEvents(broker *BrokerChannel, iceServers []webrtc.ICESer
|
|||
|
||||
// NewWebRTCDialerWithEventsAndProxy constructs a new WebRTCDialer.
|
||||
func NewWebRTCDialerWithEventsAndProxy(broker *BrokerChannel, iceServers []webrtc.ICEServer, max int,
|
||||
eventLogger event.SnowflakeEventReceiver, proxy *url.URL) *WebRTCDialer {
|
||||
eventLogger event.SnowflakeEventReceiver, proxy *url.URL,
|
||||
) *WebRTCDialer {
|
||||
config := webrtc.Configuration{
|
||||
ICEServers: iceServers,
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ import (
|
|||
"syscall"
|
||||
|
||||
pt "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/goptlib"
|
||||
|
||||
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/ptutil/safelog"
|
||||
|
||||
sf "gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/client/lib"
|
||||
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/event"
|
||||
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/proxy"
|
||||
|
|
|
@ -43,6 +43,7 @@ import (
|
|||
"github.com/pion/ice/v2"
|
||||
"github.com/pion/transport/v2/stdnet"
|
||||
"github.com/pion/webrtc/v3"
|
||||
|
||||
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/event"
|
||||
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/messages"
|
||||
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/namematcher"
|
||||
|
|
|
@ -55,7 +55,7 @@ const (
|
|||
// WindowSize is the number of packets in the send and receive window of a KCP connection.
|
||||
WindowSize = 65535
|
||||
// StreamSize controls the maximum amount of in flight data between a client and server.
|
||||
StreamSize = 1048576 //1MB
|
||||
StreamSize = 1048576 // 1MB
|
||||
)
|
||||
|
||||
// Transport is a structure with methods that conform to the Go PT v2.1 API
|
||||
|
@ -66,7 +66,6 @@ type Transport struct {
|
|||
|
||||
// NewSnowflakeServer returns a new server-side Transport for Snowflake.
|
||||
func NewSnowflakeServer(getCertificate func(*tls.ClientHelloInfo) (*tls.Certificate, error)) *Transport {
|
||||
|
||||
return &Transport{getCertificate: getCertificate}
|
||||
}
|
||||
|
||||
|
@ -164,7 +163,6 @@ func (t *Transport) Listen(addr net.Addr, numKCPInstances int) (*SnowflakeListen
|
|||
}
|
||||
|
||||
return listener, nil
|
||||
|
||||
}
|
||||
|
||||
type SnowflakeListener struct {
|
||||
|
@ -182,7 +180,7 @@ type SnowflakeListener struct {
|
|||
func (l *SnowflakeListener) Accept() (net.Conn, error) {
|
||||
select {
|
||||
case <-l.closed:
|
||||
//channel has been closed, no longer accepting connections
|
||||
// channel has been closed, no longer accepting connections
|
||||
return nil, io.ErrClosedPipe
|
||||
case conn := <-l.queue:
|
||||
return conn, nil
|
||||
|
@ -304,6 +302,7 @@ func (conn *SnowflakeClientConn) SetDeadline(t time.Time) error { return conn.st
|
|||
func (conn *SnowflakeClientConn) SetReadDeadline(t time.Time) error {
|
||||
return conn.stream.SetReadDeadline(t)
|
||||
}
|
||||
|
||||
func (conn *SnowflakeClientConn) SetWriteDeadline(t time.Time) error {
|
||||
return conn.stream.SetWriteDeadline(t)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue