Add UDP Like transport mode to snowflake

This commit is contained in:
Shelikhoo 2023-12-12 14:43:30 +00:00 committed by WofWca
parent fa122efb61
commit 457c4fbf15
8 changed files with 275 additions and 5 deletions

View file

@ -41,6 +41,8 @@ type webRTCConn struct {
cancelTimeoutLoop context.CancelFunc
bytesLogger bytesLogger
protocol string
}
func newWebRTCConn(pc *webrtc.PeerConnection, dc *webrtc.DataChannel, pr *io.PipeReader, bytesLogger bytesLogger) *webRTCConn {
@ -137,6 +139,14 @@ func (c *webRTCConn) SetWriteDeadline(t time.Time) error {
return fmt.Errorf("SetWriteDeadline not implemented")
}
func (c *webRTCConn) SetConnectionProtocol(protocol string) {
c.protocol = protocol
}
func (c *webRTCConn) GetConnectionProtocol() string {
return c.protocol
}
func remoteIPFromSDP(str string) net.IP {
// Look for remote IP in "a=candidate" attribute fields
// https://tools.ietf.org/html/rfc5245#section-15.1