All Downloads are FREE. Search and download functionalities are using the official Maven repository.

vendor.github.com.pion.ice.v2.stun.go Maven / Gradle / Ivy

There is a newer version: 2.9.1
Show newest version
package ice

import (
	"fmt"

	"github.com/pion/stun"
)

func assertInboundUsername(m *stun.Message, expectedUsername string) error {
	var username stun.Username
	if err := username.GetFrom(m); err != nil {
		return err
	}
	if string(username) != expectedUsername {
		return fmt.Errorf("%w expected(%x) actual(%x)", errMismatchUsername, expectedUsername, string(username))
	}

	return nil
}

func assertInboundMessageIntegrity(m *stun.Message, key []byte) error {
	messageIntegrityAttr := stun.MessageIntegrity(key)
	return messageIntegrityAttr.Check(m)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy