Skip to content

Commit

Permalink
Fix golangci-lint warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
stv0g committed May 5, 2023
1 parent 476d624 commit b8d6fcc
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 57 deletions.
7 changes: 4 additions & 3 deletions jsep.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ func extMapURI() map[int]string {
// some settings that are required by the JSEP spec.
//
// Note: Since v2.4.0, session ID has been fixed to use crypto random according to
// JSEP spec, so that NewJSEPSessionDescription now returns error as a second
// return value.
//
// JSEP spec, so that NewJSEPSessionDescription now returns error as a second
// return value.
func NewJSEPSessionDescription(identity bool) (*SessionDescription, error) {
sid, err := newSessionID()
if err != nil {
Expand Down Expand Up @@ -123,7 +124,7 @@ func (s *SessionDescription) WithMedia(md *MediaDescription) *SessionDescription

// NewJSEPMediaDescription creates a new MediaName with
// some settings that are required by the JSEP spec.
func NewJSEPMediaDescription(codecType string, codecPrefs []string) *MediaDescription {
func NewJSEPMediaDescription(codecType string, _ []string) *MediaDescription {
return &MediaDescription{
MediaName: MediaName{
Media: codecType,
Expand Down
51 changes: 27 additions & 24 deletions marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,37 @@ import (
// Marshal takes a SDP struct to text
// https://tools.ietf.org/html/rfc4566#section-5
// Session description
// v= (protocol version)
// o= (originator and session identifier)
// s= (session name)
// i=* (session information)
// u=* (URI of description)
// e=* (email address)
// p=* (phone number)
// c=* (connection information -- not required if included in
// all media)
// b=* (zero or more bandwidth information lines)
// One or more time descriptions ("t=" and "r=" lines; see below)
// z=* (time zone adjustments)
// k=* (encryption key)
// a=* (zero or more session attribute lines)
// Zero or more media descriptions
//
// v= (protocol version)
// o= (originator and session identifier)
// s= (session name)
// i=* (session information)
// u=* (URI of description)
// e=* (email address)
// p=* (phone number)
// c=* (connection information -- not required if included in
// all media)
// b=* (zero or more bandwidth information lines)
// One or more time descriptions ("t=" and "r=" lines; see below)
// z=* (time zone adjustments)
// k=* (encryption key)
// a=* (zero or more session attribute lines)
// Zero or more media descriptions
//
// Time description
// t= (time the session is active)
// r=* (zero or more repeat times)
//
// t= (time the session is active)
// r=* (zero or more repeat times)
//
// Media description, if present
// m= (media name and transport address)
// i=* (media title)
// c=* (connection information -- optional if included at
// session level)
// b=* (zero or more bandwidth information lines)
// k=* (encryption key)
// a=* (zero or more media attribute lines)
//
// m= (media name and transport address)
// i=* (media title)
// c=* (connection information -- optional if included at
// session level)
// b=* (zero or more bandwidth information lines)
// k=* (encryption key)
// a=* (zero or more media attribute lines)
func (s *SessionDescription) Marshal() ([]byte, error) {
m := make(marshaller, 0, 1024)

Expand Down
67 changes: 37 additions & 30 deletions unmarshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,48 +25,55 @@ var (
// (namely s1, s2, s3, ...) for a parsing procedure that complies with the
// specifications laid out by the rfc4566#section-5 as well as by JavaScript
// Session Establishment Protocol draft. Links:
// https://tools.ietf.org/html/rfc4566#section-5
// https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-24
//
// https://tools.ietf.org/html/rfc4566#section-5
// https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-24
//
// https://tools.ietf.org/html/rfc4566#section-5
// Session description
// v= (protocol version)
// o= (originator and session identifier)
// s= (session name)
// i=* (session information)
// u=* (URI of description)
// e=* (email address)
// p=* (phone number)
// c=* (connection information -- not required if included in
// all media)
// b=* (zero or more bandwidth information lines)
// One or more time descriptions ("t=" and "r=" lines; see below)
// z=* (time zone adjustments)
// k=* (encryption key)
// a=* (zero or more session attribute lines)
// Zero or more media descriptions
//
// v= (protocol version)
// o= (originator and session identifier)
// s= (session name)
// i=* (session information)
// u=* (URI of description)
// e=* (email address)
// p=* (phone number)
// c=* (connection information -- not required if included in
// all media)
// b=* (zero or more bandwidth information lines)
// One or more time descriptions ("t=" and "r=" lines; see below)
// z=* (time zone adjustments)
// k=* (encryption key)
// a=* (zero or more session attribute lines)
// Zero or more media descriptions
//
// Time description
// t= (time the session is active)
// r=* (zero or more repeat times)
//
// t= (time the session is active)
// r=* (zero or more repeat times)
//
// Media description, if present
// m= (media name and transport address)
// i=* (media title)
// c=* (connection information -- optional if included at
// session level)
// b=* (zero or more bandwidth information lines)
// k=* (encryption key)
// a=* (zero or more media attribute lines)
//
// m= (media name and transport address)
// i=* (media title)
// c=* (connection information -- optional if included at
// session level)
// b=* (zero or more bandwidth information lines)
// k=* (encryption key)
// a=* (zero or more media attribute lines)
//
// In order to generate the following state table and draw subsequent
// deterministic finite-state automota ("DFA") the following regex was used to
// derive the DFA:
// vosi?u?e?p?c?b*(tr*)+z?k?a*(mi?c?b*k?a*)*
//
// vosi?u?e?p?c?b*(tr*)+z?k?a*(mi?c?b*k?a*)*
//
// possible place and state to exit:
// ** * * * ** * * * *
// 99 1 1 1 11 1 1 1 1
// 3 1 1 26 5 5 4 4
//
// ** * * * ** * * * *
// 99 1 1 1 11 1 1 1 1
// 3 1 1 26 5 5 4 4
//
// Please pay close attention to the `k`, and `a` parsing states. In the table
// below in order to distinguish between the states belonging to the media
Expand Down

0 comments on commit b8d6fcc

Please sign in to comment.