Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated to pion/webrtc@v3 #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ gfile
dist/
cover/

*.wasm
*.wasm

.idea/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ It allows to share a file directly between two computers, without the need of a

## Note

This project is still in its early stage.
This project is provided as is, as a PoC. It isn't intended for any production use, as it lacks proper error handling & retrial logic.

## How does it work ?

Expand Down
7 changes: 2 additions & 5 deletions _client/web/emitter.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ func sendFile(fileContent js.Value) {

// Notify client, in progress
if err := sess.Start(); err != nil {
// Notifiy client of error
// Notify client of error
// TODO: Handle error
}
// Notifiy client of end
// Notify client of end
processDone <- struct{}{}
}

Expand Down Expand Up @@ -101,9 +101,6 @@ func onMenuSendFileClickHandler(_ js.Value, _ []js.Value) interface{} {
Configuration: common.Configuration{
SDPProvider: sdpInput,
SDPOutput: sdpOutput,
OnCompletion: func() {
// TODO: Notify user ?
},
},
})
globalSess = sess
Expand Down
2 changes: 0 additions & 2 deletions _client/web/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ func onReceiveFileButtonClick(_ js.Value, _ []js.Value) interface{} {
Configuration: common.Configuration{
SDPProvider: sdpInput,
SDPOutput: sdpOutput,
OnCompletion: func() {
},
},
})

Expand Down
53 changes: 0 additions & 53 deletions cmd/bench/cmd.go

This file was deleted.

6 changes: 2 additions & 4 deletions cmd/install.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package cmd

import (
"sort"

"github.com/antonito/gfile/cmd/bench"
"github.com/antonito/gfile/cmd/receive"
"github.com/antonito/gfile/cmd/send"
"sort"

log "github.com/sirupsen/logrus"
"gopkg.in/urfave/cli.v1"
)
Expand All @@ -15,7 +14,6 @@ func Install(app *cli.App) {
app.Commands = []cli.Command{
send.New(),
receive.New(),
bench.New(),
}
log.Trace("Installed commands")

Expand Down
5 changes: 0 additions & 5 deletions cmd/send/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"os"

"github.com/antonito/gfile/internal/utils"
"github.com/antonito/gfile/pkg/session/common"
"github.com/antonito/gfile/pkg/session/sender"
log "github.com/sirupsen/logrus"
"gopkg.in/urfave/cli.v1"
Expand All @@ -23,10 +22,6 @@ func handler(c *cli.Context) error {
defer f.Close()
conf := sender.Config{
Stream: f,
Configuration: common.Configuration{
OnCompletion: func() {
},
},
}

customSTUN := c.String("stun")
Expand Down
21 changes: 8 additions & 13 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,13 @@ module github.com/antonito/gfile
go 1.12

require (
github.com/golang/protobuf v1.3.1 // indirect
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/lucas-clemente/quic-go v0.11.0 // indirect
github.com/onsi/ginkgo v1.8.0 // indirect
github.com/onsi/gomega v1.5.0 // indirect
github.com/pion/webrtc/v2 v2.0.1
github.com/sirupsen/logrus v1.4.1
github.com/stretchr/testify v1.3.0
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 // indirect
golang.org/x/sys v0.0.0-20190405154228-4b34438f7a67 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
github.com/google/uuid v1.2.0 // indirect
github.com/magefile/mage v1.11.0 // indirect
github.com/pion/webrtc/v3 v3.0.11
github.com/sirupsen/logrus v1.8.0
github.com/stretchr/testify v1.7.0
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83 // indirect
golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d // indirect
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43 // indirect
gopkg.in/urfave/cli.v1 v1.20.0
gopkg.in/yaml.v2 v2.2.2 // indirect
)
191 changes: 125 additions & 66 deletions go.sum

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions internal/buffer/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,38 @@ type Buffer struct {
func (b *Buffer) Read(p []byte) (n int, err error) {
b.m.Lock()
defer b.m.Unlock()

return b.b.Read(p)
}

// ReadString in a thread-safe way
func (b *Buffer) ReadString(delim byte) (line string, err error) {
b.m.Lock()
defer b.m.Unlock()

return b.b.ReadString(delim)
}

// Write in a thread-safe way
func (b *Buffer) Write(p []byte) (n int, err error) {
b.m.Lock()
defer b.m.Unlock()

return b.b.Write(p)
}

// WriteString in a thread-safe way
func (b *Buffer) WriteString(s string) (n int, err error) {
b.m.Lock()
defer b.m.Unlock()

return b.b.WriteString(s)
}

// String in a thread-safe way
func (b *Buffer) String() string {
b.m.Lock()
defer b.m.Unlock()

return b.b.String()
}
2 changes: 1 addition & 1 deletion internal/session/getters.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ import "io"

// SDPProvider returns the SDP input
func (s *Session) SDPProvider() io.Reader {
return s.sdpInput
return s.sdpIO.Input
}
Loading