Skip to content

Commit

Permalink
Fix is-server being ignored in stun-multiplex
Browse files Browse the repository at this point in the history
Call `flag.Parse()` first to enable normal reading
of parameters
  • Loading branch information
gongluck authored and Sean-Der committed Aug 16, 2024
1 parent 95c14ef commit 298aed4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cmd/stun-multiplex/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ func multiplex(conn *net.UDPConn, stunAddr net.Addr, stunConn io.Reader) {
var stunServer = flag.String("stun", "stun.l.google.com:19302", "STUN Server to use") //nolint:gochecknoglobals

func main() {
isServer := flag.Arg(0) == ""

flag.Parse()

isServer := flag.Arg(0) == ""

Check warning on line 90 in cmd/stun-multiplex/main.go

View check run for this annotation

Codecov / codecov/patch

cmd/stun-multiplex/main.go#L90

Added line #L90 was not covered by tests

// Allocating local UDP socket that will be used both for STUN and
// our application data.
addr, err := net.ResolveUDPAddr("udp4", "0.0.0.0:0")
Expand Down
4 changes: 2 additions & 2 deletions integrity.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ const credentialsSep = ":"
// credentials. Password, username, and realm must be SASL-prepared.
func NewLongTermIntegrity(username, realm, password string) MessageIntegrity {
k := strings.Join([]string{username, realm, password}, credentialsSep)
h := md5.New() //nolint:gosec
fmt.Fprint(h, k)
h := md5.New() //nolint:gosec
fmt.Fprint(h, k) //nolint:errcheck
return MessageIntegrity(h.Sum(nil))
}

Expand Down

0 comments on commit 298aed4

Please sign in to comment.