mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Add covert-dtls to proxy and client with flags
This commit is contained in:
parent
ae5bd52821
commit
541e124194
8 changed files with 88 additions and 16 deletions
|
@ -41,8 +41,11 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/pion/dtls/v3"
|
||||
"github.com/pion/transport/v3/stdnet"
|
||||
"github.com/pion/webrtc/v4"
|
||||
"github.com/theodorsm/covert-dtls/pkg/mimicry"
|
||||
"github.com/theodorsm/covert-dtls/pkg/randomize"
|
||||
|
||||
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/event"
|
||||
"gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/v2/common/messages"
|
||||
|
@ -165,6 +168,9 @@ type SnowflakeProxy struct {
|
|||
|
||||
periodicProxyStats *periodicProxyStats
|
||||
bytesLogger bytesLogger
|
||||
|
||||
DTLSRandomize bool
|
||||
DTLSMimic bool
|
||||
}
|
||||
|
||||
// Checks whether an IP address is a remote address for the client
|
||||
|
@ -423,6 +429,23 @@ func (sf *SnowflakeProxy) makeWebRTCAPI() *webrtc.API {
|
|||
|
||||
settingsEngine.SetDTLSInsecureSkipHelloVerify(true)
|
||||
|
||||
if sf.DTLSRandomize {
|
||||
rand := randomize.RandomizedMessageClientHello{RandomALPN: true}
|
||||
settingsEngine.SetDTLSClientHelloMessageHook(rand.Hook)
|
||||
} else if sf.DTLSMimic {
|
||||
mimic := &mimicry.MimickedClientHello{}
|
||||
profiles := []dtls.SRTPProtectionProfile{
|
||||
dtls.SRTP_AES128_CM_HMAC_SHA1_80,
|
||||
dtls.SRTP_AES128_CM_HMAC_SHA1_32,
|
||||
dtls.SRTP_AEAD_AES_128_GCM,
|
||||
dtls.SRTP_AEAD_AES_256_GCM,
|
||||
dtls.SRTP_AES256_CM_SHA1_32,
|
||||
dtls.SRTP_AES256_CM_SHA1_80,
|
||||
}
|
||||
settingsEngine.SetSRTPProtectionProfiles(profiles...)
|
||||
settingsEngine.SetDTLSClientHelloMessageHook(mimic.Hook)
|
||||
}
|
||||
|
||||
return webrtc.NewAPI(webrtc.WithSettingEngine(settingsEngine))
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue