diff options
author | Sam Whited <sam@samwhited.com> | 2022-03-11 13:22:29 -0500 |
---|---|---|
committer | Sam Whited <sam@samwhited.com> | 2022-03-15 09:26:50 -0400 |
commit | 2d95d4d069124df4a4e2473fc23ad3feed19905d (patch) | |
tree | 4e53db9f07cfda2e17745a6870f294db2d4eb756 /vendor/github.com/pion/datachannel/message.go | |
parent | c8dc651f72c09ce252cee729bfc09d8ca6744c36 (diff) |
Remove vendor from git
Previously we saved the vendor tree in version control, making any
commit that changed a dependency rather large.
Go Modules gives us most of the advantages of vendoring except that if a
dependency which is not stored on the proxy is deleted we would lose
access to it.
For now, we can remove the vendor tree and when we get CI working again
we can possibly generate and save the vendor tree as a build artifact.
Signed-off-by: Sam Whited <sam@samwhited.com>
Diffstat (limited to 'vendor/github.com/pion/datachannel/message.go')
-rw-r--r-- | vendor/github.com/pion/datachannel/message.go | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/vendor/github.com/pion/datachannel/message.go b/vendor/github.com/pion/datachannel/message.go deleted file mode 100644 index 84665cb..0000000 --- a/vendor/github.com/pion/datachannel/message.go +++ /dev/null @@ -1,94 +0,0 @@ -package datachannel - -import ( - "fmt" - - "github.com/pkg/errors" -) - -// message is a parsed DataChannel message -type message interface { - Marshal() ([]byte, error) - Unmarshal([]byte) error -} - -// messageType is the first byte in a DataChannel message that specifies type -type messageType byte - -// DataChannel Message Types -const ( - dataChannelAck messageType = 0x02 - dataChannelOpen messageType = 0x03 -) - -func (t messageType) String() string { - switch t { - case dataChannelAck: - return "DataChannelAck" - case dataChannelOpen: - return "DataChannelOpen" - default: - return fmt.Sprintf("Unknown MessageType: %d", t) - } -} - -// parse accepts raw input and returns a DataChannel message -func parse(raw []byte) (message, error) { - if len(raw) == 0 { - return nil, errors.Errorf("DataChannel message is not long enough to determine type ") - } - - var msg message - switch messageType(raw[0]) { - case dataChannelOpen: - msg = &channelOpen{} - case dataChannelAck: - msg = &channelAck{} - default: - return nil, errors.Errorf("Unknown MessageType %v", messageType(raw[0])) - } - - if err := msg.Unmarshal(raw); err != nil { - return nil, err - } - - return msg, nil -} - -// parseExpectDataChannelOpen parses a DataChannelOpen message -// or throws an error -func parseExpectDataChannelOpen(raw []byte) (*channelOpen, error) { - if len(raw) == 0 { - return nil, errors.Errorf("the DataChannel message is not long enough to determine type") - } - - if actualTyp := messageType(raw[0]); actualTyp != dataChannelOpen { - return nil, errors.Errorf("expected DataChannelOpen but got %s", actualTyp) - } - - msg := &channelOpen{} - if err := msg.Unmarshal(raw); err != nil { - return nil, err - } - - return msg, nil -} - -// parseExpectDataChannelAck parses a DataChannelAck message -// or throws an error -// func parseExpectDataChannelAck(raw []byte) (*channelAck, error) { -// if len(raw) == 0 { -// return nil, errors.Errorf("the DataChannel message is not long enough to determine type") -// } -// -// if actualTyp := messageType(raw[0]); actualTyp != dataChannelAck { -// return nil, errors.Errorf("expected DataChannelAck but got %s", actualTyp) -// } -// -// msg := &channelAck{} -// if err := msg.Unmarshal(raw); err != nil { -// return nil, err -// } -// -// return msg, nil -// } |