mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 13:21:00 +02:00
add compression and encryption
This commit is contained in:
parent
8b97306617
commit
8fd312d876
13 changed files with 59 additions and 77 deletions
5
main.go
5
main.go
|
@ -21,7 +21,7 @@ func main() {
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
// break
|
// break
|
||||||
// }
|
// }
|
||||||
// fmt.Println(bytes.Equal(buffer[:bytesread], emptyBuffer[:bytesread]))
|
// log.Debugln(bytes.Equal(buffer[:bytesread], emptyBuffer[:bytesread]))
|
||||||
// }
|
// }
|
||||||
var sender bool
|
var sender bool
|
||||||
flag.BoolVar(&sender, "sender", false, "sender")
|
flag.BoolVar(&sender, "sender", false, "sender")
|
||||||
|
@ -35,7 +35,8 @@ func main() {
|
||||||
// PathToFile: "../wskeystore/README.md",
|
// PathToFile: "../wskeystore/README.md",
|
||||||
// PathToFile: "./src/croc/croc.go",
|
// PathToFile: "./src/croc/croc.go",
|
||||||
// PathToFiles: []string{"C:\\Users\\zacks\\go\\src\\github.com\\schollz\\croc\\src\\croc\\croc.go", "croc.exe"},
|
// PathToFiles: []string{"C:\\Users\\zacks\\go\\src\\github.com\\schollz\\croc\\src\\croc\\croc.go", "croc.exe"},
|
||||||
PathToFiles: []string{"croc2.exe", "croc3.exe"},
|
// PathToFiles: []string{"croc2.exe"}, //,"croc2.exe", "croc3.exe"},
|
||||||
|
PathToFiles: []string{"README.md"}, //,"croc2.exe", "croc3.exe"},
|
||||||
KeepPathInRemote: false,
|
KeepPathInRemote: false,
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -68,11 +68,11 @@ func BenchmarkCompressLevelNineBinary(b *testing.B) {
|
||||||
func TestCompress(t *testing.T) {
|
func TestCompress(t *testing.T) {
|
||||||
compressedB := CompressWithOption(fable, 9)
|
compressedB := CompressWithOption(fable, 9)
|
||||||
dataRateSavings := 100 * (1.0 - float64(len(compressedB))/float64(len(fable)))
|
dataRateSavings := 100 * (1.0 - float64(len(compressedB))/float64(len(fable)))
|
||||||
fmt.Printf("Level 9: %2.0f%% percent space savings\n", dataRateSavings)
|
log.Debugf("Level 9: %2.0f%% percent space savings\n", dataRateSavings)
|
||||||
assert.True(t, len(compressedB) < len(fable))
|
assert.True(t, len(compressedB) < len(fable))
|
||||||
|
|
||||||
compressedB = CompressWithOption(fable, -2)
|
compressedB = CompressWithOption(fable, -2)
|
||||||
dataRateSavings = 100 * (1.0 - float64(len(compressedB))/float64(len(fable)))
|
dataRateSavings = 100 * (1.0 - float64(len(compressedB))/float64(len(fable)))
|
||||||
fmt.Printf("Level -2: %2.0f%% percent space savings\n", dataRateSavings)
|
log.Debugf("Level -2: %2.0f%% percent space savings\n", dataRateSavings)
|
||||||
assert.True(t, len(compressedB) < len(fable))
|
assert.True(t, len(compressedB) < len(fable))
|
||||||
}
|
}
|
||||||
|
|
|
@ -394,7 +394,6 @@ func (c *Client) processMessage(m Message) (err error) {
|
||||||
// start receiving data
|
// start receiving data
|
||||||
pathToFile := path.Join(c.FilesToTransfer[c.FilesToTransferCurrentNum].FolderRemote, c.FilesToTransfer[c.FilesToTransferCurrentNum].Name)
|
pathToFile := path.Join(c.FilesToTransfer[c.FilesToTransferCurrentNum].FolderRemote, c.FilesToTransfer[c.FilesToTransferCurrentNum].Name)
|
||||||
c.recvSess.ReceiveData(pathToFile, c.FilesToTransfer[c.FilesToTransferCurrentNum].Size)
|
c.recvSess.ReceiveData(pathToFile, c.FilesToTransfer[c.FilesToTransferCurrentNum].Size)
|
||||||
fmt.Println("\ndone receiving")
|
|
||||||
err = c.redisdb.Publish(c.nameOutChannel, Message{
|
err = c.redisdb.Publish(c.nameOutChannel, Message{
|
||||||
Type: "close-sender",
|
Type: "close-sender",
|
||||||
}.String()).Err()
|
}.String()).Err()
|
||||||
|
|
|
@ -5,9 +5,7 @@ import (
|
||||||
"crypto/cipher"
|
"crypto/cipher"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
"encoding/base64"
|
"encoding/json"
|
||||||
"errors"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
"golang.org/x/crypto/pbkdf2"
|
"golang.org/x/crypto/pbkdf2"
|
||||||
)
|
)
|
||||||
|
@ -20,28 +18,28 @@ type Encryption struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e Encryption) Bytes() []byte {
|
func (e Encryption) Bytes() []byte {
|
||||||
return []byte(base64.StdEncoding.EncodeToString(e.Encrypted) + "-" + base64.StdEncoding.EncodeToString(e.Salt) + "-" + base64.StdEncoding.EncodeToString(e.IV))
|
b, _ := json.Marshal(e)
|
||||||
|
return b
|
||||||
}
|
}
|
||||||
|
|
||||||
func FromBytes(b []byte) (enc Encryption, err error) {
|
func FromBytes(b []byte) (enc Encryption, err error) {
|
||||||
enc = Encryption{}
|
err = json.Unmarshal(b, &enc)
|
||||||
items := strings.Split(string(b), "-")
|
|
||||||
if len(items) != 3 {
|
|
||||||
err = errors.New("not valid")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
enc.Encrypted, err = base64.StdEncoding.DecodeString(items[0])
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
enc.Salt, err = base64.StdEncoding.DecodeString(items[1])
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
enc.IV, err = base64.StdEncoding.DecodeString(items[2])
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func DecryptFromBytes(b []byte, passphrase []byte, dontencrypt ...bool) (decrypted []byte, err error) {
|
||||||
|
enc, err := FromBytes(b)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return enc.Decrypt(passphrase, dontencrypt...)
|
||||||
|
}
|
||||||
|
|
||||||
|
func EncryptToBytes(plaintext []byte, passphrase []byte, dontencrypt ...bool) []byte {
|
||||||
|
enc := Encrypt(plaintext, passphrase, dontencrypt...)
|
||||||
|
return enc.Bytes()
|
||||||
|
}
|
||||||
|
|
||||||
// Encrypt will generate an encryption
|
// Encrypt will generate an encryption
|
||||||
func Encrypt(plaintext []byte, passphrase []byte, dontencrypt ...bool) Encryption {
|
func Encrypt(plaintext []byte, passphrase []byte, dontencrypt ...bool) Encryption {
|
||||||
if len(dontencrypt) > 0 && dontencrypt[0] {
|
if len(dontencrypt) > 0 && dontencrypt[0] {
|
||||||
|
|
|
@ -6,6 +6,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestGetIP(t *testing.T) {
|
func TestGetIP(t *testing.T) {
|
||||||
fmt.Println(PublicIP())
|
log.Debugln(PublicIP())
|
||||||
fmt.Println(LocalIP())
|
log.Debugln(LocalIP())
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package session
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"log"
|
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/pion/webrtc/v2"
|
"github.com/pion/webrtc/v2"
|
||||||
|
@ -30,7 +29,6 @@ type Session struct {
|
||||||
|
|
||||||
// New creates a new Session
|
// New creates a new Session
|
||||||
func New(sdpInput io.Reader, sdpOutput io.Writer) Session {
|
func New(sdpInput io.Reader, sdpOutput io.Writer) Session {
|
||||||
log.Println("making new channel")
|
|
||||||
if sdpInput == nil {
|
if sdpInput == nil {
|
||||||
sdpInput = os.Stdin
|
sdpInput = os.Stdin
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,8 @@ func (s *Session) Start() error {
|
||||||
// Wait for benchmarks to be done
|
// Wait for benchmarks to be done
|
||||||
s.wg.Wait()
|
s.wg.Wait()
|
||||||
|
|
||||||
fmt.Printf("Upload: %s\n", s.uploadNetworkStats.String())
|
log.Debugf("Upload: %s\n", s.uploadNetworkStats.String())
|
||||||
fmt.Printf("Download: %s\n", s.downloadNetworkStats.String())
|
log.Debugf("Download: %s\n", s.downloadNetworkStats.String())
|
||||||
s.sess.OnCompletion()
|
s.sess.OnCompletion()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ func (s *Session) onOpenHandlerDownload(dc *webrtc.DataChannel) func() {
|
||||||
// Useful for unit tests
|
// Useful for unit tests
|
||||||
if dc != nil {
|
if dc != nil {
|
||||||
dc.OnMessage(func(msg webrtc.DataChannelMessage) {
|
dc.OnMessage(func(msg webrtc.DataChannelMessage) {
|
||||||
fmt.Printf("Downloading at %.2f MB/s\r", s.downloadNetworkStats.Bandwidth())
|
log.Debugf("Downloading at %.2f MB/s\r", s.downloadNetworkStats.Bandwidth())
|
||||||
s.downloadNetworkStats.AddBytes(uint64(len(msg.Data)))
|
s.downloadNetworkStats.AddBytes(uint64(len(msg.Data)))
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
@ -32,7 +32,7 @@ func (s *Session) onOpenHandlerDownload(dc *webrtc.DataChannel) func() {
|
||||||
}
|
}
|
||||||
|
|
||||||
timeoutErr := time.After(s.testDurationError)
|
timeoutErr := time.After(s.testDurationError)
|
||||||
fmt.Printf("Downloading random datas ... (%d s)\n", int(s.testDuration.Seconds()))
|
log.Debugf("Downloading random datas ... (%d s)\n", int(s.testDuration.Seconds()))
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-s.downloadDone:
|
case <-s.downloadDone:
|
||||||
|
@ -46,7 +46,7 @@ func (s *Session) onOpenHandlerDownload(dc *webrtc.DataChannel) func() {
|
||||||
close(s.startPhase2)
|
close(s.startPhase2)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("\n")
|
log.Debugf("\n")
|
||||||
s.downloadNetworkStats.Stop()
|
s.downloadNetworkStats.Stop()
|
||||||
s.wg.Done()
|
s.wg.Done()
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ func (s *Session) onOpenUploadHandler(dc *webrtc.DataChannel) func() {
|
||||||
dc.SetBufferedAmountLowThreshold(s.bufferThreshold)
|
dc.SetBufferedAmountLowThreshold(s.bufferThreshold)
|
||||||
dc.OnBufferedAmountLow(func() {
|
dc.OnBufferedAmountLow(func() {
|
||||||
if err := dc.Send(token); err == nil {
|
if err := dc.Send(token); err == nil {
|
||||||
fmt.Printf("Uploading at %.2f MB/s\r", s.uploadNetworkStats.Bandwidth())
|
log.Debugf("Uploading at %.2f MB/s\r", s.uploadNetworkStats.Bandwidth())
|
||||||
s.uploadNetworkStats.AddBytes(lenToken)
|
s.uploadNetworkStats.AddBytes(lenToken)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -39,7 +39,7 @@ func (s *Session) onOpenUploadHandler(dc *webrtc.DataChannel) func() {
|
||||||
log.Warningln("No DataChannel provided")
|
log.Warningln("No DataChannel provided")
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("Uploading random datas ... (%d s)\n", int(s.testDuration.Seconds()))
|
log.Debugf("Uploading random datas ... (%d s)\n", int(s.testDuration.Seconds()))
|
||||||
timeout := time.After(s.testDuration)
|
timeout := time.After(s.testDuration)
|
||||||
timeoutErr := time.After(s.testDurationError)
|
timeoutErr := time.After(s.testDurationError)
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ func (s *Session) onOpenUploadHandler(dc *webrtc.DataChannel) func() {
|
||||||
break SENDING_LOOP
|
break SENDING_LOOP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Printf("\n")
|
log.Debugf("\n")
|
||||||
s.uploadNetworkStats.Stop()
|
s.uploadNetworkStats.Stop()
|
||||||
|
|
||||||
if dc != nil {
|
if dc != nil {
|
||||||
|
|
|
@ -2,13 +2,14 @@ package receiver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/mattn/go-colorable"
|
"github.com/mattn/go-colorable"
|
||||||
"github.com/pion/webrtc/v2"
|
"github.com/pion/webrtc/v2"
|
||||||
|
"github.com/schollz/croc/v5/src/compress"
|
||||||
|
"github.com/schollz/croc/v5/src/crypt"
|
||||||
internalSess "github.com/schollz/croc/v5/src/webrtc/internal/session"
|
internalSess "github.com/schollz/croc/v5/src/webrtc/internal/session"
|
||||||
"github.com/schollz/croc/v5/src/webrtc/pkg/session/common"
|
"github.com/schollz/croc/v5/src/webrtc/pkg/session/common"
|
||||||
"github.com/schollz/progressbar/v2"
|
"github.com/schollz/progressbar/v2"
|
||||||
|
@ -164,11 +165,17 @@ func (s *Session) receiveData(pathToFile string, fileSize int64) error {
|
||||||
select {
|
select {
|
||||||
case <-s.sess.Done:
|
case <-s.sess.Done:
|
||||||
s.sess.NetworkStats.Stop()
|
s.sess.NetworkStats.Stop()
|
||||||
fmt.Printf("\nNetwork: %s\n", s.sess.NetworkStats.String())
|
log.Debugf("Network: %s", s.sess.NetworkStats.String())
|
||||||
return nil
|
return nil
|
||||||
case msg := <-s.msgChannel:
|
case msg := <-s.msgChannel:
|
||||||
pos := int64(binary.LittleEndian.Uint64(msg.Data[:8]))
|
buff, errDecrypt := crypt.DecryptFromBytes(msg.Data, []byte{1, 2, 3, 4})
|
||||||
n, err := f.WriteAt(msg.Data[8:], pos)
|
if errDecrypt != nil {
|
||||||
|
log.Error(errDecrypt)
|
||||||
|
return errDecrypt
|
||||||
|
}
|
||||||
|
buff = compress.Decompress(buff)
|
||||||
|
pos := int64(binary.LittleEndian.Uint64(buff[:8]))
|
||||||
|
n, err := f.WriteAt(buff[8:], pos)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else {
|
} else {
|
||||||
|
@ -184,7 +191,7 @@ func (s *Session) receiveData(pathToFile string, fileSize int64) error {
|
||||||
}
|
}
|
||||||
bar.Add(n)
|
bar.Add(n)
|
||||||
// currentSpeed := s.sess.NetworkStats.Bandwidth()
|
// currentSpeed := s.sess.NetworkStats.Bandwidth()
|
||||||
// fmt.Printf("Transferring at %.2f MB/s\r", currentSpeed)
|
// log.Debugf("Transferring at %.2f MB/s\r", currentSpeed)
|
||||||
// s.sess.NetworkStats.AddBytes(uint64(n))
|
// s.sess.NetworkStats.AddBytes(uint64(n))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package sender
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
|
||||||
"io"
|
"io"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
|
@ -10,6 +9,8 @@ import (
|
||||||
|
|
||||||
colorable "github.com/mattn/go-colorable"
|
colorable "github.com/mattn/go-colorable"
|
||||||
"github.com/pion/webrtc/v2"
|
"github.com/pion/webrtc/v2"
|
||||||
|
"github.com/schollz/croc/v5/src/compress"
|
||||||
|
"github.com/schollz/croc/v5/src/crypt"
|
||||||
internalSess "github.com/schollz/croc/v5/src/webrtc/internal/session"
|
internalSess "github.com/schollz/croc/v5/src/webrtc/internal/session"
|
||||||
"github.com/schollz/croc/v5/src/webrtc/pkg/session/common"
|
"github.com/schollz/croc/v5/src/webrtc/pkg/session/common"
|
||||||
"github.com/schollz/croc/v5/src/webrtc/pkg/stats"
|
"github.com/schollz/croc/v5/src/webrtc/pkg/stats"
|
||||||
|
@ -19,7 +20,9 @@ import (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Must be <= 16384
|
// Must be <= 16384
|
||||||
senderBuffSize = 16376
|
// 8 bytes for position
|
||||||
|
// 3000 bytes for encryption / compression overhead
|
||||||
|
senderBuffSize = 13376
|
||||||
bufferThreshold = 512 * 1024 // 512kB
|
bufferThreshold = 512 * 1024 // 512kB
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -205,13 +208,18 @@ func (s *Session) readFile(pathToFile string) error {
|
||||||
}
|
}
|
||||||
s.dataBuff = s.dataBuff[:n]
|
s.dataBuff = s.dataBuff[:n]
|
||||||
s.readingStats.AddBytes(uint64(n))
|
s.readingStats.AddBytes(uint64(n))
|
||||||
|
|
||||||
posByte := make([]byte, 8)
|
posByte := make([]byte, 8)
|
||||||
binary.LittleEndian.PutUint64(posByte, pos)
|
binary.LittleEndian.PutUint64(posByte, pos)
|
||||||
|
|
||||||
buff := append([]byte(nil), posByte...)
|
buff := append([]byte(nil), posByte...)
|
||||||
|
buff = append(buff, s.dataBuff...)
|
||||||
|
buff = compress.Compress(buff)
|
||||||
|
buff = crypt.EncryptToBytes(buff, []byte{1, 2, 3, 4})
|
||||||
s.output <- outputMsg{
|
s.output <- outputMsg{
|
||||||
n: n,
|
n: n,
|
||||||
// Make a copy of the buffer
|
// Make a copy of the buffer
|
||||||
buff: append(buff, s.dataBuff...),
|
buff: buff,
|
||||||
}
|
}
|
||||||
pos += uint64(n)
|
pos += uint64(n)
|
||||||
}
|
}
|
||||||
|
@ -230,7 +238,7 @@ func (s *Session) onBufferedAmountLow() func() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// currentSpeed := s.sess.NetworkStats.Bandwidth()
|
// currentSpeed := s.sess.NetworkStats.Bandwidth()
|
||||||
// fmt.Printf("Transferring at %.2f MB/s\r", currentSpeed)
|
// log.Debugf("Transferring at %.2f MB/s\r", currentSpeed)
|
||||||
|
|
||||||
for len(s.msgToBeSent) != 0 {
|
for len(s.msgToBeSent) != 0 {
|
||||||
cur := s.msgToBeSent[0]
|
cur := s.msgToBeSent[0]
|
||||||
|
@ -303,8 +311,5 @@ func (s *Session) close(calledFromCloseHandler bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Session) dumpStats() {
|
func (s *Session) dumpStats() {
|
||||||
fmt.Printf(`
|
log.Debugf(`Disk : %s, Network: %s`, s.readingStats.String(), s.sess.NetworkStats.String())
|
||||||
Disk : %s
|
|
||||||
Network: %s
|
|
||||||
`, s.readingStats.String(), s.sess.NetworkStats.String())
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ func Test_TransferSmallMessage(t *testing.T) {
|
||||||
// Get SDP from sender and send it to the client
|
// Get SDP from sender and send it to the client
|
||||||
sdp, err := utils.MustReadStream(senderSDPOutput)
|
sdp, err := utils.MustReadStream(senderSDPOutput)
|
||||||
assert.Nil(err)
|
assert.Nil(err)
|
||||||
fmt.Printf("READ SDP -> %s\n", sdp)
|
log.Debugf("READ SDP -> %s\n", sdp)
|
||||||
sdp += "\n"
|
sdp += "\n"
|
||||||
n, err = clientSDPProvider.WriteString(sdp)
|
n, err = clientSDPProvider.WriteString(sdp)
|
||||||
assert.Nil(err)
|
assert.Nil(err)
|
||||||
|
@ -89,7 +89,7 @@ func Test_TransferSmallMessage(t *testing.T) {
|
||||||
assert.Nil(err)
|
assert.Nil(err)
|
||||||
assert.Equal(len(sdp), n)
|
assert.Equal(len(sdp), n)
|
||||||
|
|
||||||
fmt.Println("Waiting for everyone to be done...")
|
log.Debugln("Waiting for everyone to be done...")
|
||||||
<-senderDone
|
<-senderDone
|
||||||
<-clientDone
|
<-clientDone
|
||||||
|
|
||||||
|
|
|
@ -1,40 +1,14 @@
|
||||||
package utils
|
package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"io"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// MustReadStream blocks until input is received from the stream
|
|
||||||
func MustReadStream(stream io.Reader) (string, error) {
|
|
||||||
r := bufio.NewReader(stream)
|
|
||||||
|
|
||||||
var in string
|
|
||||||
for {
|
|
||||||
var err error
|
|
||||||
in, err = r.ReadString('\n')
|
|
||||||
if err != io.EOF {
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
in = strings.TrimSpace(in)
|
|
||||||
if len(in) > 0 {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Println("")
|
|
||||||
return in, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// StripSDP remove useless elements from an SDP
|
// StripSDP remove useless elements from an SDP
|
||||||
func StripSDP(originalSDP string) string {
|
func StripSDP(originalSDP string) string {
|
||||||
finalSDP := strings.Replace(originalSDP, "a=group:BUNDLE audio video data", "a=group:BUNDLE data", -1)
|
finalSDP := strings.Replace(originalSDP, "a=group:BUNDLE audio video data", "a=group:BUNDLE data", -1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue