Skip to content

Commit 35179f1

Browse files
gongluckSean-Der
authored andcommitted
Fix is-server being ignored in stun-multiplex
Call `flag.Parse()` first to enable normal reading of parameters
1 parent 95c14ef commit 35179f1

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

cmd/stun-multiplex/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ func multiplex(conn *net.UDPConn, stunAddr net.Addr, stunConn io.Reader) {
8585
var stunServer = flag.String("stun", "stun.l.google.com:19302", "STUN Server to use") //nolint:gochecknoglobals
8686

8787
func main() {
88-
isServer := flag.Arg(0) == ""
89-
9088
flag.Parse()
9189

90+
isServer := flag.Arg(0) == ""
91+
9292
// Allocating local UDP socket that will be used both for STUN and
9393
// our application data.
9494
addr, err := net.ResolveUDPAddr("udp4", "0.0.0.0:0")

integrity.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ const credentialsSep = ":"
2020
// credentials. Password, username, and realm must be SASL-prepared.
2121
func NewLongTermIntegrity(username, realm, password string) MessageIntegrity {
2222
k := strings.Join([]string{username, realm, password}, credentialsSep)
23-
h := md5.New() //nolint:gosec
24-
fmt.Fprint(h, k)
23+
h := md5.New() //nolint:gosec
24+
fmt.Fprint(h, k) //nolint:errcheck
2525
return MessageIntegrity(h.Sum(nil))
2626
}
2727

0 commit comments

Comments
 (0)